Files
linux-odyssey/quests/read/game.yml
T
2023-11-23 15:06:34 +08:00

146 lines
3.9 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
title: 查看檔案內容
instruction: |
在這個關卡中,你將會學到:
1. 如何使用 `cat` 查看檔案的內容
請輸入 `echo start` 來開始這一關。
requirements:
- path
stages:
- id: warning-01
repeatable: true
condition:
command:
- ' '
hints:
- '!! 請勿使用全形空格 !!'
- id: start
task: 輸入 `echo start` 來開始教程
condition:
output:
- ^start$
responses:
- content:
- 在終端機中,並沒有圖形介面可以讓你查看檔案的內容。
- 但是你可以透過 `cat` 指令來查看檔案的內容。
- '`cat` 指令是 concatenate 的縮寫,也就是串接的意思。'
- 在輸入 `cat [檔案名稱]` 指令後,終端機會輸出檔案的內容。
- 請你先查看這個資料夾中哪些檔案。
hints:
- ➤ 請輸入 `ls` 來查看這個資料夾中的檔案。
- id: ls-~
task: 查看資料夾中的檔案
requirements:
- start
condition:
pwd:
- ^/home/commander$
command:
- ^ls$
responses:
- content:
- 這個資料夾中有一個檔案和一個資料夾。
- 現在你可以使用 `cat` 指令來查看 `file.txt` 的內容。
hints:
- ➤ 請輸入 `cat file.txt` 來查看檔案的內容。
- id: cat-file
task: 查看 `file.txt` 的內容
requirements:
- ls-~
condition:
pwd:
- ^/home/commander$
command:
- ^cat file.txt$
responses:
- content:
- 你應該能看到檔案的內容了。
- 接下來,請你嘗試進入 `folder` 資料夾,並查看資料夾中的檔案內容。
hints:
- ➤ 請輸入 `cat -n file.txt` 來查看檔案的內容並顯示行數。
- id: cd-folder
task: 進入 `folder` 資料夾
requirements:
- cat-file
condition:
pwd:
- ^/home/commander$
or:
- command:
- ^cat -n file.txt$
- command:
- ^cat file.txt -n$
responses:
- content:
- 你應該能看到檔案的內容和行數了。
- 接下來,請你進入 `folder` 資料夾,並查看資料夾內有哪些檔案。
hints:
- ➤ 輸入 `cd folder` 來進入 `folder` 資料夾
- id: cd-folder
task: 進入 `folder` 資料夾
requirements:
- cat-n-file
condition:
pwd:
- ^/home/commander/folder$
responses:
- content:
- 現在你已經進入 `folder` 資料夾了。
- 請查看資料夾內有哪些檔案。
hints:
- ➤ 請輸入 `ls` 來查看資料夾中的檔案。
- id: ls-folder
task: 查看 `folder` 資料夾中的檔案
requirements:
- cd-folder
condition:
pwd:
- ^/home/commander/folder$
command:
- ^ls$
responses:
- content:
- 這個資料夾中有一個檔案,叫做 `words.txt`。
- 請用 `cat` 指令找出檔案中第 139 行的內容。
hints:
- ➤ 請輸入 `cat -n words.txt` 來查看檔案的內容。
- id: cat-n-words
task: 查看 `words.txt` 的內容
requirements:
- ls-folder
condition:
pwd:
- ^/home/commander/folder$
or:
- command:
- ^cat -n words.txt$
- command:
- ^cat words.txt -n$
responses:
- content:
- 你應該能看到檔案的內容和行數了。
- 請用 `echo` 指令來在終端機顯示檔案中第 139 行的內容。
hints:
- ➤ 請輸入 `echo [第 139 行的內容]` 來顯示檔案中第 139 行的內容。
- id: END
task: 這是教學的結束
condition:
command:
- ' '
responses:
- content:
- 這是教學的結束。
- 請輸入 `echo end` 來結束這一關。
hints:
- ➤ 請輸入 `echo end` 來結束這一關。