diff --git a/quests/cast/game.yml b/quests/cast/game.yml index ce1c1e7..512b94e 100644 --- a/quests/cast/game.yml +++ b/quests/cast/game.yml @@ -1,16 +1,14 @@ title: 輸出文字 instruction: | 在這個關卡中,你將會學到: - 1. 如何使用 `echo` 指令 - - 按下中間的 `start` 按鈕來開始這個關卡。 + 1. 如何使用 `echo` 在終端機上顯示文字。 requirements: - get-started stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$ diff --git a/quests/checkpoint-01/Dockerfile b/quests/checkpoint-01/Dockerfile new file mode 100644 index 0000000..2a8e341 --- /dev/null +++ b/quests/checkpoint-01/Dockerfile @@ -0,0 +1,3 @@ +FROM linuxodyssey/quest-base + +COPY home ${HOME} \ No newline at end of file diff --git a/quests/checkpoint-01/answer.sh b/quests/checkpoint-01/answer.sh new file mode 100644 index 0000000..cee7368 --- /dev/null +++ b/quests/checkpoint-01/answer.sh @@ -0,0 +1,7 @@ +echo start +echo next +ls +cd folder03 +pwd +cd ../folder02 +ls ../folder01 \ No newline at end of file diff --git a/quests/checkpoint-01/game.yml b/quests/checkpoint-01/game.yml new file mode 100644 index 0000000..c59613a --- /dev/null +++ b/quests/checkpoint-01/game.yml @@ -0,0 +1,110 @@ +title: 測驗一 +instruction: | + 在這個關卡中,將會考驗你是否理解以下內容: + 1. `echo`:用來輸出文字 + 2. `ls`:用來查看資料夾的內容 + 3. `cd`:用來在資料夾之間移動 + 4. `pwd`:用來顯示目前的路徑 + +requirements: + - path + +stages: + - id: start + task: 按下 `開始` 按鈕開始 + condition: + command: + - ^echo start$ + responses: + - type: narrative + content: | + 這個關卡將會測試你是否理解之前的教學內容。 + 因此不會告訴你要輸入什麼指令。 + 請思考並應用正確的指令來完成任務。 + + 現在,請讓終端機輸出 `next` 來繼續。 + + - id: next + task: 讓終端機輸出 `next` + requirements: + - start + condition: + output: + - ^next$ + responses: + - type: narrative + content: | + 現在請你查看目前資料夾的內容。 + + - id: ls-~ + task: 查看目前資料夾的內容 + requirements: + - next + condition: + pwd: + - ^/home/commander$ + command: + - ^ls$ + responses: + - type: narrative + content: | + 請進入 `folder03` 資料夾。 + + - id: cd-folder03 + task: 進入 `folder03` 資料夾 + requirements: + - ls-~ + condition: + pwd: + - ^/home/commander/folder03$ + responses: + - type: narrative + content: | + 請在終端機顯示目前的路徑。 + + - id: pwd-folder03 + task: 顯示目前的路徑 + requirements: + - cd-folder03 + condition: + command: + - ^pwd$ + output: + - ^/home/commander/folder03$ + responses: + - type: narrative + content: | + 現在請你進入 `folder02` 資料夾, + 並查看 `folder02` 資料夾的內容。 + + - id: ls-folder02 + task: 進入並查看 `folder02` 資料夾的內容 + requirements: + - pwd-folder03 + condition: + pwd: + - ^/home/commander/folder02$ + command: + - ^ls$ + responses: + - type: narrative + content: | + 最後,請你留在 `folder02` 資料夾, + 並查看 `folder01` 資料夾的內容。 + + - id: END + requirements: + - ls-folder02 + task: 留在 `folder02` 資料夾,查看 `folder01` 資料夾的內容。 + condition: + pwd: + - ^/home/commander/folder02$ + command: + - ^ls + output: + - file1.txt + responses: + - type: narrative + content: | + 恭喜你通過了這個測驗! + 你可以繼續學習之後的教學內容了。 diff --git a/quests/checkpoint-01/home/folder01/file1.txt b/quests/checkpoint-01/home/folder01/file1.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/checkpoint-01/home/folder02/file2.txt b/quests/checkpoint-01/home/folder02/file2.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/checkpoint-01/home/folder03/file3.txt b/quests/checkpoint-01/home/folder03/file3.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/checkpoint-02/Dockerfile b/quests/checkpoint-02/Dockerfile new file mode 100644 index 0000000..2a8e341 --- /dev/null +++ b/quests/checkpoint-02/Dockerfile @@ -0,0 +1,3 @@ +FROM linuxodyssey/quest-base + +COPY home ${HOME} \ No newline at end of file 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..f630944 --- /dev/null +++ b/quests/checkpoint-02/game.yml @@ -0,0 +1,108 @@ +title: 測驗二 +instruction: | + 在這個關卡中,將會考驗你是否理解以下內容: + 1. `cat`:用來查看檔案的內容 + 2. `touch`:用來建立檔案 + 3. `mkdir`:用來建立資料夾 + 4. 用 `tab` 鍵來自動補全 + 5. 之前測驗包含的內容 + +requirements: + - create + +stages: + - id: start + task: 按下 `開始` 按鈕開始 + condition: + command: + - ^echo start$ + responses: + - type: narrative + content: | + 這個關卡將會測試你是否理解之前的教學內容。 + 因此不會告訴你要輸入什麼指令。 + 請思考並應用正確的指令來完成任務。 + + 現在,請讓終端機輸出 `next` 來繼續。 + + - id: next + task: 讓終端機輸出 `next` + requirements: + - start + condition: + output: + - ^next$ + responses: + - type: narrative + content: | + 現在請你查看目前資料夾的內容。 + + - id: ls-~ + task: 查看目前資料夾的內容 + requirements: + - next + condition: + pwd: + - ^/home/commander$ + command: + - ^ls$ + responses: + - type: narrative + content: | + 請查看 `hello.txt` 檔案的內容。 + + - id: cat-hello + task: 查看 `hello.txt` 檔案內容 + requirements: + - ls-~ + condition: + command: + - ^cat hello.txt$ + output: + - ^This is `hello.txt`.$ + responses: + - type: narrative + content: | + 請查看另一個有著很長檔名的檔案內容。 + + - id: cat-long-filename + task: 查看另一個檔案的內容 + 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.$ + responses: + - type: narrative + content: | + 現在請你建立一個名稱為 `folder` 的資料夾。 + + - id: mkdir-folder + task: 建立名稱為 `folder` 的資料夾 + requirements: + - cat-long-filename + condition: + files: + - path: /home/commander/folder + type: folder + responses: + - type: narrative + content: | + 最後,請你在 `folder` 資料夾中, + 建立檔名為 `file.txt` 的檔案。 + + - id: END + requirements: + - mkdir-folder + task: 在 `folder` 中建立檔名為 `file.txt` 的檔案 + condition: + files: + - path: /home/commander/folder/file.txt + type: file + responses: + - type: narrative + 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. diff --git a/quests/checkpoint-03/Dockerfile b/quests/checkpoint-03/Dockerfile new file mode 100644 index 0000000..377fb37 --- /dev/null +++ b/quests/checkpoint-03/Dockerfile @@ -0,0 +1,7 @@ +FROM linuxodyssey/quest-base + +USER root +COPY home . +RUN chown -R ${USERNAME}:${USERNAME} . + +USER ${USERNAME} \ No newline at end of file diff --git a/quests/checkpoint-03/answer.sh b/quests/checkpoint-03/answer.sh new file mode 100644 index 0000000..3b39b6d --- /dev/null +++ b/quests/checkpoint-03/answer.sh @@ -0,0 +1,12 @@ +echo start +echo next +ls +cd folder +cp hello.txt world.txt +rm hello.txt +mv world.txt .. +cd .. +mv world.txt hello.txt +cat hello.txt +rmdir folder +rm -r trash_can \ No newline at end of file diff --git a/quests/checkpoint-03/game.yml b/quests/checkpoint-03/game.yml new file mode 100644 index 0000000..1f1c858 --- /dev/null +++ b/quests/checkpoint-03/game.yml @@ -0,0 +1,153 @@ +title: 測驗三 +instruction: | + 在這個關卡中,將會考驗你是否理解以下內容: + 1. `cp`:用來複製檔案和資料夾 + 2. `mv`:用來移動檔案和資料夾或更改名稱 + 3. `rm`:用來刪除檔案和資料夾 + 4. `rmdir`:用來刪除空的資料夾 + 5. 透過選項讓指令達成不同的功能,例如 `rm -r` + 6. 之前測驗包含的內容 + +requirements: + - remove + +stages: + - id: start + task: 按下 `開始` 按鈕開始 + condition: + command: + - ^echo start$ + responses: + - type: narrative + content: | + 這個關卡將會測試你是否理解之前的教學內容。 + 因此不會告訴你要輸入什麼指令。 + 請思考並應用正確的指令來完成任務。 + + 現在,請讓終端機輸出 `next` 來繼續。 + + - id: next + task: 讓終端機輸出 `next` + requirements: + - start + condition: + output: + - ^next$ + responses: + - type: narrative + content: | + 現在請你查看目前資料夾的內容。 + + - id: ls-~ + task: 查看目前資料夾的內容 + requirements: + - next + condition: + pwd: + - ^/home/commander$ + command: + - ^ls$ + responses: + - type: narrative + content: | + 請複製 `folder` 資料夾中的檔案到 `folder` 中,並命名為 `world.txt` 。 + + - id: cp-hello-world + task: 複製 `folder` 中的檔案並命名為 `world.txt` + requirements: + - ls-~ + condition: + command: + - ^cp .*hello.txt .*world.txt$ + files: + - path: /home/commander/folder/hello.txt + type: file + - path: /home/commander/folder/world.txt + type: file + responses: + - type: narrative + content: | + 請刪除 `hello.txt` 檔案。 + + - id: rm-hello + task: 刪除 `hello.txt` + requirements: + - cp-hello-world + condition: + command: + - ^rm .*hello.txt$ + files: + - path: /home/commander/folder/hello.txt + type: file + exists: false + responses: + - type: narrative + content: | + 現在請將 `world.txt` 移出 `folder` 資料夾。 + (移到 `commander` 資料夾中) + + - id: mv-world-.. + task: 將 `world.txt` 移出 `folder` 資料夾 + requirements: + - rm-hello + condition: + files: + - path: /home/commander/folder/world.txt + type: file + exists: false + - path: /home/commander/world.txt + type: file + responses: + - type: narrative + content: | + 將 `world.txt` 的名稱改回 `hello.txt` , + 並查看檔案的內容。 + + - id: cat-hello + task: 將 `world.txt` 的名稱改回 `hello.txt` 後查看檔案內容 + requirements: + - mv-world-.. + condition: + command: + - ^cat hello.txt$ + files: + - path: /home/commander/world.txt + type: file + exists: false + - path: /home/commander/hello.txt + type: file + output: + - ^This is `hello.txt`.$ + responses: + - type: narrative + content: | + 刪除 `folder` 資料夾。 + + - id: rmdir-folder + task: 刪除 `folder` 資料夾 + requirements: + - cat-hello + condition: + files: + - path: /home/commander/folder + type: folder + exists: false + responses: + - type: narrative + content: | + 刪除 `trash_can` 資料夾。 + + - id: END + requirements: + - rmdir-folder + task: 刪除 `trash_can` 資料夾 + condition: + files: + - path: /home/commander/trash_can + type: folder + exists: false + responses: + - type: narrative + content: | + 恭喜你通過了這個測驗! + 你可以繼續學習之後的教學內容了。 diff --git a/quests/checkpoint-03/home/folder/hello.txt b/quests/checkpoint-03/home/folder/hello.txt new file mode 100644 index 0000000..3bd5213 --- /dev/null +++ b/quests/checkpoint-03/home/folder/hello.txt @@ -0,0 +1 @@ +This is `hello.txt`. diff --git a/quests/checkpoint-03/home/trash_can/garbage.txt b/quests/checkpoint-03/home/trash_can/garbage.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/checkpoint-03/home/trash_can/rubbish.txt b/quests/checkpoint-03/home/trash_can/rubbish.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/checkpoint-03/home/trash_can/secret/letter.txt b/quests/checkpoint-03/home/trash_can/secret/letter.txt new file mode 100644 index 0000000..b95980b --- /dev/null +++ b/quests/checkpoint-03/home/trash_can/secret/letter.txt @@ -0,0 +1 @@ +aHR0cHM6Ly9yZXVybC5jYy9YUjZZMDA= diff --git a/quests/checkpoint-03/home/trash_can/trash.txt b/quests/checkpoint-03/home/trash_can/trash.txt new file mode 100644 index 0000000..e69de29 diff --git a/quests/copy/answer.sh b/quests/copy/answer.sh index c8835c7..bef48aa 100644 --- a/quests/copy/answer.sh +++ b/quests/copy/answer.sh @@ -2,7 +2,7 @@ echo start ls cat hello.txt cat world.txt -echo continue +echo next cp hello.txt hello2.txt cat hello2.txt cp world.txt world2.txt diff --git a/quests/copy/game.yml b/quests/copy/game.yml index 3dad1bc..df02412 100644 --- a/quests/copy/game.yml +++ b/quests/copy/game.yml @@ -1,16 +1,14 @@ title: 複製檔案 instruction: | 在這個關卡中,你將會學到: - 1. 如何用 `cp` 指令複製檔案 - - 按下中間的 `start` 按鈕來開始這個關卡。 + 1. 如何使用 `cp` 複製檔案 requirements: - create stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$ @@ -46,7 +44,8 @@ stages: 請使用 `cd /home/commander` 來返回 `/home/commander` 資料夾。 responses: - type: narrative - content: 可以看到現在資料夾裡有 `hello.txt` 跟 `world.txt`。 + content: | + 可以看到現在資料夾裡有 `hello.txt` 跟 `world.txt`。 請使用 `cat` 來查看它們的內容。 看完之後,使用 `echo next` 來繼續吧! hints: diff --git a/quests/create/game.yml b/quests/create/game.yml index 3d93b15..1499ae5 100644 --- a/quests/create/game.yml +++ b/quests/create/game.yml @@ -4,14 +4,12 @@ instruction: | 1. 如何使用 `touch` 建立檔案 2. 如何使用 `mkdir` 建立資料夾 - 按下中間的 `start` 按鈕來開始這個關卡。 - requirements: - tab stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$ diff --git a/quests/explore/game.yml b/quests/explore/game.yml index d02c7e0..c8b92a0 100644 --- a/quests/explore/game.yml +++ b/quests/explore/game.yml @@ -4,14 +4,12 @@ instruction: | 1. 如何使用 `ls` 查看資料夾的內容 2. 如何使用 `cd` 在資料夾之間移動 - 按下中間的 `start` 按鈕來開始這個關卡。 - requirements: - get-started stages: - id: start - task: 按下 `start` 按鈕開始教程 + task: 按下 `開始` 按鈕開始教程 condition: command: - ^echo start$ diff --git a/quests/get-started/game.yml b/quests/get-started/game.yml index 399861a..6e489da 100644 --- a/quests/get-started/game.yml +++ b/quests/get-started/game.yml @@ -5,11 +5,9 @@ instruction: | 1. 如何使用這個網站 2. 如何使用終端機 - 按下中間的 `start` 按鈕來開始這個關卡。 - stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$ diff --git a/quests/move/answer.sh b/quests/move/answer.sh index c55e8f2..a24458b 100644 --- a/quests/move/answer.sh +++ b/quests/move/answer.sh @@ -1,9 +1,9 @@ echo start -echo continue +echo next mv hello.txt notes ls ls notes -echo continue +echo next mv world.txt wow.txt ls mv notes docs diff --git a/quests/move/game.yml b/quests/move/game.yml index da2234a..25c82ab 100644 --- a/quests/move/game.yml +++ b/quests/move/game.yml @@ -1,16 +1,14 @@ title: 移動檔案 instruction: | 在這個關卡中,你將會學到: - 1. 如何用 `mv` 移動檔案與資料夾 - - 按下中間的 `start` 按鈕來開始這個關卡。 + 1. 如何使用 `mv` 移動檔案與資料夾 requirements: - create stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$ diff --git a/quests/path/game.yml b/quests/path/game.yml index 98c69cd..923623e 100644 --- a/quests/path/game.yml +++ b/quests/path/game.yml @@ -4,15 +4,13 @@ instruction: | 1. 絕對路徑和相對路徑 2. 如何使用 `pwd` 顯示目前的路徑 - 按下中間的 `start` 按鈕來開始這個關卡。 - requirements: - cast - explore stages: - id: start - task: 按下 `start` 按鈕開始教程 + task: 按下 `開始` 按鈕開始教程 condition: command: - ^echo start$ diff --git a/quests/read/game.yml b/quests/read/game.yml index d1b92c3..525c494 100644 --- a/quests/read/game.yml +++ b/quests/read/game.yml @@ -3,14 +3,12 @@ instruction: | 在這個關卡中,你將會學到: 1. 如何使用 `cat` 查看檔案的內容 - 按下中間的 `start` 按鈕來開始這個關卡。 - requirements: - path stages: - id: start - task: 按下 `start` 按鈕開始教程 + task: 按下 `開始` 按鈕開始教程 condition: command: - ^echo start$ diff --git a/quests/remove/game.yml b/quests/remove/game.yml index 89d179a..a6086ce 100644 --- a/quests/remove/game.yml +++ b/quests/remove/game.yml @@ -1,12 +1,9 @@ title: 刪除檔案與資料夾 instruction: | 在這個關卡中,你將會學到: - 1. 用 `rm` 指令刪除檔案 - 2. 用 `rmdir` 與資料夾 - 3. 用 `rm -r` 刪除資料夾與它的所有檔案 - 現在資料夾裡有一些檔案與資料夾,請你使用 `ls` 跟 `cat` 來查看它們的內容。 - - 按下中間的 `start` 按鈕來開始這個關卡。 + 1. 如何使用 `rm` 指令刪除檔案 + 2. 如何使用 `rmdir` 刪除空資料夾 + 3. 如何使用 `rm -r` 刪除資料夾與其中的所有檔案 requirements: - copy @@ -14,7 +11,7 @@ requirements: stages: - id: start - task: 按下 `start` 按鈕開始 + task: 按下 `開始` 按鈕開始 condition: command: - ^echo start$