mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
Quest: remove unnecessary ls-stages (#195)
* quest: remove ls-stages in create * feat: prevent throwing errors when failed to copy files * feat: log new command in dev mode * quest: copy * quest: mv * quest: rm * quest: execute. Add many exceptions * feat: pwd discovers parent folders
This commit is contained in:
1 parent
f0a09ac4d9
commit
3b77d91796
9 files changed
+147
-217
No files matched your search
+11
-24
@@ -78,6 +78,10 @@ stages:
|
||||
response:
|
||||
content: |
|
||||
你成功查看到 `hello.txt` 的內容了!
|
||||
內容是:
|
||||
```
|
||||
Hello
|
||||
```
|
||||
|
||||
- id: cat-world
|
||||
name: 查看 `world.txt` 的內容
|
||||
@@ -113,6 +117,10 @@ stages:
|
||||
response:
|
||||
content: |
|
||||
你成功查看到 `world.txt` 的內容了!
|
||||
內容是:
|
||||
```
|
||||
World
|
||||
```
|
||||
|
||||
- id: cat-next
|
||||
name: 輸入 `echo next` 來繼續
|
||||
@@ -271,30 +279,9 @@ stages:
|
||||
response:
|
||||
content: |
|
||||
你成功複製 `notes` 資料夾到 `notes2` 了!
|
||||
我們打開來確認一下 `notes2` 資料夾的內容吧!
|
||||
hint: 使用 `ls notes2` 來查看 `notes2` 資料夾的內容
|
||||
|
||||
- id: ls-notes2
|
||||
name: 查看 `notes2` 資料夾的內容
|
||||
requirements:
|
||||
- cp-notes
|
||||
condition:
|
||||
pwd: /home/commander
|
||||
command: ls notes2
|
||||
output: note.txt
|
||||
exceptions:
|
||||
- id: wrong_directory
|
||||
condition:
|
||||
not:
|
||||
pwd: /home/commander
|
||||
response:
|
||||
content: |
|
||||
你不在 `/home/commander` 資料夾裡。
|
||||
請使用 `cd /home/commander` 來返回 `/home/commander` 資料夾。
|
||||
response:
|
||||
content: |
|
||||
你成功查看到 `notes2` 資料夾的內容了!
|
||||
我們可以看到,整個 `notes` 資料夾包含裡面的檔案,都被複製到 `notes2` 資料夾了。
|
||||
使用 `cp -r` 複製資料夾,不論資料夾中有多少檔案,多少層目錄,都可以一次複製過去。
|
||||
|
||||
那麼最後我們要來試試看,如果複製一個檔案到已經存在的檔案會發生什麼事。
|
||||
請把 `hello.txt` 複製到 `world.txt` 看看會發生什麼事。
|
||||
hint: 使用 `cp hello.txt world.txt` 來複製 `hello.txt` 到 `world.txt`
|
||||
@@ -302,7 +289,7 @@ stages:
|
||||
- id: cp-overwrite
|
||||
name: 複製 `hello.txt` 到 `world.txt`
|
||||
requirements:
|
||||
- ls-notes2
|
||||
- cp-notes
|
||||
condition:
|
||||
pwd: /home/commander
|
||||
command: cp hello.txt world.txt
|
||||
|
||||
Reference in new issue
Block a user