Basic checkpoint quests (#155)

This commit is contained in:
Justin Lin authored and GitHub committed 2024-08-02 14:35:32 +08:00
commit 14bcb3b0d5
30 files changed
+434 -38

No files matched your search

+2 -4
View File
@@ -1,16 +1,14 @@
title: 輸出文字 title: 輸出文字
instruction: | instruction: |
在這個關卡中,你將會學到: 在這個關卡中,你將會學到:
1. 如何使用 `echo` 指令 1. 如何使用 `echo` 在終端機上顯示文字。
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- get-started - get-started
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+3
View File
@@ -0,0 +1,3 @@
FROM linuxodyssey/quest-base
COPY home ${HOME}
+7
View File
@@ -0,0 +1,7 @@
echo start
echo next
ls
cd folder03
pwd
cd ../folder02
ls ../folder01
+110
View File
@@ -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: |
恭喜你通過了這個測驗!
你可以繼續學習之後的教學內容了。
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+3
View File
@@ -0,0 +1,3 @@
FROM linuxodyssey/quest-base
COPY home ${HOME}
+7
View File
@@ -0,0 +1,7 @@
echo start
echo next
ls
cat hello.txt
cat pneumonoultramicroscopicsilicovolcanoconiosis.txt
mkdir folder
touch folder/file.txt
+108
View File
@@ -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: |
恭喜你通過了這個測驗!
你可以繼續學習之後的教學內容了。
+1
View File
@@ -0,0 +1 @@
This is `hello.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.
+7
View File
@@ -0,0 +1,7 @@
FROM linuxodyssey/quest-base
USER root
COPY home .
RUN chown -R ${USERNAME}:${USERNAME} .
USER ${USERNAME}
+12
View File
@@ -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
+153
View File
@@ -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: |
恭喜你通過了這個測驗!
你可以繼續學習之後的教學內容了。
@@ -0,0 +1 @@
This is `hello.txt`.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
aHR0cHM6Ly9yZXVybC5jYy9YUjZZMDA=
Whitespace-only changes.
+1 -1
View File
@@ -2,7 +2,7 @@ echo start
ls ls
cat hello.txt cat hello.txt
cat world.txt cat world.txt
echo continue echo next
cp hello.txt hello2.txt cp hello.txt hello2.txt
cat hello2.txt cat hello2.txt
cp world.txt world2.txt cp world.txt world2.txt
+4 -5
View File
@@ -1,16 +1,14 @@
title: 複製檔案 title: 複製檔案
instruction: | instruction: |
在這個關卡中,你將會學到: 在這個關卡中,你將會學到:
1. 如何用 `cp` 指令複製檔案 1. 如何使用 `cp` 複製檔案
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- create - create
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$
@@ -46,7 +44,8 @@ stages:
請使用 `cd /home/commander` 來返回 `/home/commander` 資料夾。 請使用 `cd /home/commander` 來返回 `/home/commander` 資料夾。
responses: responses:
- type: narrative - type: narrative
content: 可以看到現在資料夾裡有 `hello.txt` 跟 `world.txt`。 content: |
可以看到現在資料夾裡有 `hello.txt` 跟 `world.txt`。
請使用 `cat` 來查看它們的內容。 請使用 `cat` 來查看它們的內容。
看完之後,使用 `echo next` 來繼續吧! 看完之後,使用 `echo next` 來繼續吧!
hints: hints:
+1 -3
View File
@@ -4,14 +4,12 @@ instruction: |
1. 如何使用 `touch` 建立檔案 1. 如何使用 `touch` 建立檔案
2. 如何使用 `mkdir` 建立資料夾 2. 如何使用 `mkdir` 建立資料夾
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- tab - tab
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+1 -3
View File
@@ -4,14 +4,12 @@ instruction: |
1. 如何使用 `ls` 查看資料夾的內容 1. 如何使用 `ls` 查看資料夾的內容
2. 如何使用 `cd` 在資料夾之間移動 2. 如何使用 `cd` 在資料夾之間移動
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- get-started - get-started
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始教程 task: 按下 `開始` 按鈕開始教程
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+1 -3
View File
@@ -5,11 +5,9 @@ instruction: |
1. 如何使用這個網站 1. 如何使用這個網站
2. 如何使用終端機 2. 如何使用終端機
按下中間的 `start` 按鈕來開始這個關卡。
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+2 -2
View File
@@ -1,9 +1,9 @@
echo start echo start
echo continue echo next
mv hello.txt notes mv hello.txt notes
ls ls
ls notes ls notes
echo continue echo next
mv world.txt wow.txt mv world.txt wow.txt
ls ls
mv notes docs mv notes docs
+2 -4
View File
@@ -1,16 +1,14 @@
title: 移動檔案 title: 移動檔案
instruction: | instruction: |
在這個關卡中,你將會學到: 在這個關卡中,你將會學到:
1. 如何用 `mv` 移動檔案與資料夾 1. 如何使用 `mv` 移動檔案與資料夾
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- create - create
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+1 -3
View File
@@ -4,15 +4,13 @@ instruction: |
1. 絕對路徑和相對路徑 1. 絕對路徑和相對路徑
2. 如何使用 `pwd` 顯示目前的路徑 2. 如何使用 `pwd` 顯示目前的路徑
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- cast - cast
- explore - explore
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始教程 task: 按下 `開始` 按鈕開始教程
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+1 -3
View File
@@ -3,14 +3,12 @@ instruction: |
在這個關卡中,你將會學到: 在這個關卡中,你將會學到:
1. 如何使用 `cat` 查看檔案的內容 1. 如何使用 `cat` 查看檔案的內容
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- path - path
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始教程 task: 按下 `開始` 按鈕開始教程
condition: condition:
command: command:
- ^echo start$ - ^echo start$
+4 -7
View File
@@ -1,12 +1,9 @@
title: 刪除檔案與資料夾 title: 刪除檔案與資料夾
instruction: | instruction: |
在這個關卡中,你將會學到: 在這個關卡中,你將會學到:
1. 用 `rm` 指令刪除檔案 1. 如何使用 `rm` 指令刪除檔案
2. 用 `rmdir` 與資料夾 2. 如何使用 `rmdir` 刪除空資料夾
3. 用 `rm -r` 刪除資料夾與它的所有檔案 3. 如何使用 `rm -r` 刪除資料夾與其中的所有檔案
現在資料夾裡有一些檔案與資料夾,請你使用 `ls` 跟 `cat` 來查看它們的內容。
按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- copy - copy
@@ -14,7 +11,7 @@ requirements:
stages: stages:
- id: start - id: start
task: 按下 `start` 按鈕開始 task: 按下 `開始` 按鈕開始
condition: condition:
command: command:
- ^echo start$ - ^echo start$