diff --git a/quests/checkpoint-02/answer.sh b/quests/checkpoint-02/answer.sh new file mode 100644 index 0000000..314821b --- /dev/null +++ b/quests/checkpoint-02/answer.sh @@ -0,0 +1,7 @@ +echo start +echo next +ls +cat hello.txt +cat pneumonoultramicroscopicsilicovolcanoconiosis.txt +mkdir folder +touch folder/file.txt \ No newline at end of file diff --git a/quests/checkpoint-02/game.yml b/quests/checkpoint-02/game.yml new file mode 100644 index 0000000..2919986 --- /dev/null +++ b/quests/checkpoint-02/game.yml @@ -0,0 +1,97 @@ +id: checkpoint-02 +title: 測驗二 +image: base +instruction: | + 在這個關卡中,將會考驗你是否理解以下內容: + 1. `cat`:用來查看檔案的內容 + 2. `touch`:用來建立檔案 + 3. `mkdir`:用來建立資料夾 + 4. 用 `tab` 鍵來自動補全 + 5. 之前測驗包含的內容 + +requirements: + - create + +stages: + - id: start + name: 按下 `開始` 按鈕開始 + condition: + command: echo start + response: + content: | + 這個關卡將會測試你是否理解之前的教學內容。 + 因此不會告訴你要輸入什麼指令。 + 請思考並應用正確的指令來完成任務。 + + 現在,請讓終端機輸出 `next` 來繼續。 + + - id: next + name: 讓終端機輸出 `next` + requirements: + - start + condition: + output: next + response: + content: | + 現在請你查看目前資料夾的內容。 + + - id: ls-home + name: 查看目前資料夾的內容 + requirements: + - next + condition: + pwd: /home/commander + command: ls + response: + content: | + 請查看 `hello.txt` 檔案的內容。 + + - id: cat-hello + name: 查看 `hello.txt` 檔案內容 + requirements: + - ls-home + condition: + command: cat hello.txt + output: This is `hello.txt`. + response: + content: | + 請查看另一個有著很長檔名的檔案內容。 + + - id: cat-long-filename + name: 查看另一個檔案的內容 + requirements: + - cat-hello + condition: + command: cat pneumonoultramicroscopicsilicovolcanoconiosis.txt + output: A name that has been invented for a lung disease caused by breathing in very small pieces of ash or dust. + response: + content: | + 現在請你建立一個名稱為 `folder` 的資料夾。 + + - id: mkdir-folder + name: 建立名稱為 `folder` 的資料夾 + requirements: + - cat-long-filename + condition: + files: + - path: /home/commander/folder + type: directory + exists: true + response: + content: | + 最後,請你在 `folder` 資料夾中, + 建立檔名為 `file.txt` 的檔案。 + + - id: finish + name: 在 `folder` 中建立檔名為 `file.txt` 的檔案 + requirements: + - mkdir-folder + condition: + files: + - path: /home/commander/folder/file.txt + type: file + exists: true + response: + content: | + 恭喜你通過了這個測驗! + 你可以繼續學習之後的教學內容了。 diff --git a/quests/checkpoint-02/home/hello.txt b/quests/checkpoint-02/home/hello.txt new file mode 100644 index 0000000..3bd5213 --- /dev/null +++ b/quests/checkpoint-02/home/hello.txt @@ -0,0 +1 @@ +This is `hello.txt`. diff --git a/quests/checkpoint-02/home/pneumonoultramicroscopicsilicovolcanoconiosis.txt b/quests/checkpoint-02/home/pneumonoultramicroscopicsilicovolcanoconiosis.txt new file mode 100644 index 0000000..7689edb --- /dev/null +++ b/quests/checkpoint-02/home/pneumonoultramicroscopicsilicovolcanoconiosis.txt @@ -0,0 +1 @@ +A name that has been invented for a lung disease caused by breathing in very small pieces of ash or dust.