quest: checkpoint-03

This commit is contained in:
Justin Lin committed 2025-04-26 12:35:20 +08:00
1 parent ad0cb3e4b2
commit 129d2ff49b
7 files changed
+154

No files matched your search

+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
+140
View File
@@ -0,0 +1,140 @@
id: checkpoint-03
title: 測驗三
image: base
instruction: |
在這個關卡中,將會考驗你是否理解以下內容:
1. `cp`:用來複製檔案和資料夾
2. `mv`:用來移動檔案和資料夾或更改名稱
3. `rm`:用來刪除檔案和資料夾
4. `rmdir`:用來刪除空的資料夾
5. 透過選項讓指令達成不同的功能,例如 `rm -r`
6. 之前測驗包含的內容
requirements:
- remove
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: |
請複製 `folder` 資料夾中的檔案到 `folder` 中,並命名為 `world.txt` 。
- id: cp-hello-world
name: 複製 `folder` 中的檔案並命名為 `world.txt`
requirements:
- ls-home
condition:
files:
- path: /home/commander/folder/hello.txt
type: file
exists: true
- path: /home/commander/folder/world.txt
type: file
exists: true
response:
content: |
請刪除 `hello.txt` 檔案。
- id: rm-hello
name: 刪除 `hello.txt`
requirements:
- cp-hello-world
condition:
files:
- path: /home/commander/folder/hello.txt
type: file
exists: false
response:
content: |
現在請將 `world.txt` 移出 `folder` 資料夾。
(移到 `commander` 資料夾中)
- id: mv-world-out
name: 將 `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
exists: true
response:
content: |
將 `world.txt` 的名稱改回 `hello.txt` ,
並查看檔案的內容。
- id: cat-hello
name: 將 `world.txt` 的名稱改回 `hello.txt` 後查看檔案內容
requirements:
- mv-world-out
condition:
command: cat hello.txt
files:
- path: /home/commander/world.txt
type: file
exists: false
- path: /home/commander/hello.txt
type: file
exists: true
output: This is `hello.txt`.
response:
content: |
刪除 `folder` 資料夾。
- id: rmdir-folder
name: 刪除 `folder` 資料夾
requirements:
- cat-hello
condition:
files:
- path: /home/commander/folder
type: directory
exists: false
response:
content: |
刪除 `trash_can` 資料夾。
- id: finish
name: 刪除 `trash_can` 資料夾
requirements:
- rmdir-folder
condition:
files:
- path: /home/commander/trash_can
type: directory
exists: false
response:
content: |
恭喜你通過了這個測驗!
你可以繼續學習之後的教學內容了。
@@ -0,0 +1 @@
This is `hello.txt`.
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1 @@
aHR0cHM6Ly9yZXVybC5jYy9YUjZZMDA=
Whitespace-only changes.