fix: update quest [create]

This commit is contained in:
Chen, Tai-Lin committed 2024-07-03 00:30:59 +08:00
1 parent dabc40eb1e
commit c87eef233c
2 files changed
+90 -51

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
echo start echo start
ls
touch hello.txt touch hello.txt
ls ls
cat hello.txt cat hello.txt
+89 -51
View File
@@ -4,40 +4,66 @@ instruction: |
1. 如何使用 `touch` 建立檔案 1. 如何使用 `touch` 建立檔案
2. 如何使用 `mkdir` 建立資料夾 2. 如何使用 `mkdir` 建立資料夾
準備好就輸入 `echo start` 開始吧! 按下中間的 `start` 按鈕來開始這個關卡。
requirements: requirements:
- read - read
stages: stages:
- id: start - id: start
task: 輸入 `echo start` 來開始 task: 按下 `start` 按鈕開始
condition: condition:
command: command:
- ^echo start - ^echo start$
responses: responses:
- type: narrative - type: narrative
content: content: |
- 這次要學習的指令是 `touch` 指令。 這次要學習的指令是 `touch` 指令。
- '`touch` 指令可以建立一個檔案。' 請你先用 `ls` 指令查看目前所在資料夾中有哪些檔案。
- 接下來,請你試著在終端機上建立一個檔案,檔名為 `hello.txt`。 你應該會發現目前所在資料夾中沒有任何檔案。
hints:
- ➤ 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案
- id: ls
task: 查看資料夾中的檔案
requirements:
- start
condition:
command:
- ^ls$
responses:
- type: narrative
content: |
你應該可以看到終端機上沒有任何回應,這表示目前所在資料夾中沒有任何檔案。
而我們可以使用 `touch [檔案名稱]` 指令來建立一個檔案。
接下來,請你試著在終端機上建立一個檔案,檔名為 `hello.txt`。
hints: hints:
- ➤ 輸入 `touch hello.txt` 來建立一個檔案 - ➤ 輸入 `touch hello.txt` 來建立一個檔案
- id: touch - id: touch
task: 使用 `touch` 指令來建立一個檔案 task: 使用 `touch` 指令來建立一個檔案
requirements: requirements:
- start - ls
condition: condition:
files: files:
- path: hello.txt - path: hello.txt
type: file type: file
exceptions:
- condition:
files:
- path: hello$
type: file
responses:
- type: narrative
content: |
你似乎忘記輸入副檔名 `txt` 了。
請再試一次,並確保檔名為 `hello.txt`。
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你應該可以看到終端機上沒有任何回應。 你應該可以看到終端機上沒有任何回應。
- 這表示 `touch` 指令已經成功建立了一個檔案。 然而實際上 `touch` 指令已經成功建立了一個檔案。
- 接下來,請你用之前學過的 `ls` 指令來查看目前所在資料夾中有哪些檔案。 請你用之前學過的 `ls` 指令來查看目前所在資料夾中有哪些檔案。
hints: hints:
- ➤ 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案 - ➤ 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案
@@ -52,26 +78,28 @@ stages:
- hello.txt - hello.txt
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你應該可以看到終端機上顯示了 `hello.txt` 這個檔案。 你應該可以看到終端機上顯示了 `hello.txt` 這個檔案。
- 我們來看看 `hello.txt` 檔案的內容吧! 我們來看看 `hello.txt` 檔案的內容吧!
- 我們可以使用之前學過的 `cat` 指令來查看檔案內容。 我們可以使用之前學過的 `cat` 指令來查看檔案內容。
hints: hints:
- ➤ 輸入 `cat hello.txt` 來查看 `hello.txt` 檔案的內容 - ➤ 輸入 `cat hello.txt` 來查看 `hello.txt` 檔案的內容
- id: cat - id: cat
task: 使用 `cat` 指令來查看 `hello.txt` 檔案的內容 task: 使用 `cat` 指令來查看 `hello.txt` 檔案的內容
requirements:
- ls-touch
condition: condition:
command: command:
- ^cat hello.txt$ - ^cat hello.txt$
responses: responses:
- type: narrative - type: narrative
content: content: |
- 咦?竟然什麼都沒有! 咦?竟然什麼都沒有!
- 沒錯,使用 `touch` 指令建立的檔案是空的。 沒錯,使用 `touch` 指令建立的檔案是空的。
- 我們在未來會學習如何編輯檔案的內容。 我們在未來會學習如何編輯檔案的內容。
- 再來試試建立其他的檔案吧! 再來試試建立其他的檔案吧!
- 請你試著在終端機上建立另一個檔案,檔名為 `world.txt`。 請你試著在終端機上建立另一個檔案,檔名為 `world.txt`。
hints: hints:
- ➤ 輸入 `touch world.txt` 來建立一個檔案 - ➤ 輸入 `touch world.txt` 來建立一個檔案
@@ -83,11 +111,21 @@ stages:
files: files:
- path: world.txt - path: world.txt
type: file type: file
exceptions:
- condition:
files:
- path: world$
type: file
responses:
- type: narrative
content: |
你似乎忘記輸入副檔名 `txt` 了。
請再試一次,並確保檔名為 `world.txt`。
responses: responses:
- type: narrative - type: narrative
content: content: |
- 非常好,你已經成功建立了第二個檔案。 非常好,你已經成功建立了第二個檔案。
- 接下來,請你用之前學過的 `ls` 指令來查看剛剛建立的兩個檔案。 接下來,請你用之前學過的 `ls` 指令來查看剛剛建立的兩個檔案。
hints: hints:
- ➤ 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案 - ➤ 輸入 `ls` 指令來查看目前所在資料夾中有哪些檔案
@@ -99,16 +137,16 @@ stages:
command: command:
- ^ls$ - ^ls$
output: output:
- hello.txt - (^|\s)hello.txt($|\s)
- world.txt - (^|\s)world.txt($|\s)
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你應該可以看到終端機上顯示了 `hello.txt` 和 `world.txt` 這兩個檔案。 你應該可以看到終端機上顯示了 `hello.txt` 和 `world.txt` 這兩個檔案。
- 接下來,我們來試試看建立資料夾吧! 接下來,我們來試試看建立資料夾吧!
- '`mkdir` 指令可以建立一個空的資料夾。' `mkdir` 指令可以建立一個空的資料夾。
- 使用方式是 `mkdir [資料夾名稱]`。 使用方式是 `mkdir [資料夾名稱]`。
- 請你試著在終端機上建立一個資料夾,名稱為 `notes`。 請你試著在終端機上建立一個資料夾,名稱為 `notes`。
hints: hints:
- ➤ 輸入 `mkdir notes` 來建立一個資料夾 - ➤ 輸入 `mkdir notes` 來建立一個資料夾
@@ -122,9 +160,9 @@ stages:
type: folder type: folder
responses: responses:
- type: narrative - type: narrative
content: content: |
- 非常好,你已經成功建立了 `notes` 資料夾。 非常好,你已經成功建立了 `notes` 資料夾。
- 接下來,請你用 `ls` 指令來查看剛剛建立的資料夾。 接下來,請你用 `ls` 指令來查看剛剛建立的資料夾。
- id: ls-mkdir - id: ls-mkdir
task: 使用 `ls` 查看剛建立的資料夾 task: 使用 `ls` 查看剛建立的資料夾
@@ -137,11 +175,11 @@ stages:
- notes - notes
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你應該可以看到終端機上顯示了 `notes` 這個資料夾。 你應該可以看到終端機上顯示了 `notes` 這個資料夾。
- 接下來,我們要在 `notes` 資料夾中建立一個 `note.txt` 的檔案。 接下來,我們要在 `notes` 資料夾中建立一個 `note.txt` 的檔案。
- 首先,我們要先進入 `notes` 資料夾。 首先,我們要先進入 `notes` 資料夾。
- 還記得之前的 `cd` 指令嗎?請你試著使用 `cd` 指令來進入 `notes` 資料夾。 還記得之前的 `cd` 指令嗎?請你試著使用 `cd` 指令來進入 `notes` 資料夾。
hints: hints:
- ➤ 輸入 `cd notes` 來進入 `notes` 資料夾 - ➤ 輸入 `cd notes` 來進入 `notes` 資料夾
- ➤ 可以在輸入到 `cd n` 時按下 `Tab` 鍵來自動補齊資料夾名稱 - ➤ 可以在輸入到 `cd n` 時按下 `Tab` 鍵來自動補齊資料夾名稱
@@ -155,9 +193,9 @@ stages:
- ^/home/commander/notes$ - ^/home/commander/notes$
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你已經成功進入了 `notes` 資料夾。 你已經成功進入了 `notes` 資料夾。
- 接下來,請你試著在 `notes` 資料夾裡建立一個檔案,檔名為 `note.txt`。 接下來,請你試著在 `notes` 資料夾裡建立一個檔案,檔名為 `note.txt`。
hints: hints:
- ➤ 輸入 `touch note.txt` 來建立一個檔案 - ➤ 輸入 `touch note.txt` 來建立一個檔案
@@ -171,9 +209,9 @@ stages:
type: file type: file
responses: responses:
- type: narrative - type: narrative
content: content: |
- 非常好,你已經成功建立了 `note.txt` 檔案。 非常好,你已經成功建立了 `note.txt` 檔案。
- 跟之前一樣,你可以使用 `ls` 指令來查看目前所在資料夾中有哪些檔案。 跟之前一樣,你可以使用 `ls` 指令來查看目前所在資料夾中有哪些檔案。
- id: END - id: END
task: 使用 `ls` 指令來查看目前所在資料夾中有哪些檔案 task: 使用 `ls` 指令來查看目前所在資料夾中有哪些檔案
@@ -186,7 +224,7 @@ stages:
- note.txt - note.txt
responses: responses:
- type: narrative - type: narrative
content: content: |
- 你應該可以看到終端機上顯示了 `note.txt` 這個檔案。 你應該可以看到終端機上顯示了 `note.txt` 這個檔案。
- 恭喜你完成了這個關卡! 恭喜你完成了這個關卡!
- 在下一個關卡中,你將學習如何複製檔案與資料夾。 在下一個關卡中,你將學習如何複製檔案與資料夾。