mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: multi-quest structure
This commit is contained in:
1 parent
2f64175df2
commit
f864cecfa4
7 files changed
+301
-72
No files matched your search
@@ -1,26 +0,0 @@
|
||||
---
|
||||
title: Hello World
|
||||
order: 1
|
||||
---
|
||||
|
||||
# Hello World
|
||||
|
||||
Welcome to your first quest! This quest will help you familiarize yourself with the terminal.
|
||||
|
||||
The terminal is a text-based interface that allows you to interact directly with your computer's operating system. You can perform various tasks by typing commands into the terminal and pressing `Enter` to execute them.
|
||||
|
||||
For your first task, you are going to use the `echo` command.
|
||||
|
||||
## Task 1: Using the `echo` Command
|
||||
|
||||
The `echo` command in Unix is used to display line of text/string that are passed as an argument. This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file.
|
||||
|
||||
Here is what you need to do:
|
||||
|
||||
1. Open your terminal.
|
||||
2. Type `echo Hello World` and hit `Enter`.
|
||||
3. You should see `Hello World` output to the terminal. This is because `echo` prints its arguments to the standard output, which is your terminal by default.
|
||||
|
||||
Congratulation! You've just run your first terminal command!
|
||||
|
||||
Stay tuned for the next quests where you'll delve deeper into more complex and powerful terminal commands.
|
||||
@@ -1,42 +0,0 @@
|
||||
PROMPT='%F{2}%n%f:%F{6}%~%f $ '
|
||||
unsetopt CASE_GLOB
|
||||
setopt CHASE_LINKS
|
||||
emulate bash
|
||||
|
||||
set +o prompt_cr
|
||||
|
||||
preexec() {
|
||||
export CMD_START_TIME=$(date +%s%N) # capture start time
|
||||
export CMD_NAME=$1 # capture command
|
||||
|
||||
# A list of interactive commands
|
||||
interactive_commands=("vim" "nano" "top" "ssh" "less" "zsh" "bash")
|
||||
|
||||
# Check if the command is in the list of interactive commands
|
||||
if [[ " ${interactive_commands[@]} " =~ " $1 " ]]; then
|
||||
# If it is, just execute it normally
|
||||
exec
|
||||
else
|
||||
# If it's not, execute it and redirect its output to a file
|
||||
exec > >(tee /tmp/cmd.out) 2> >(tee /tmp/cmd.error >&2)
|
||||
fi
|
||||
}
|
||||
|
||||
precmd() {
|
||||
export CMD_END_TIME=$(date +%s%N) # capture end time
|
||||
export CMD_EXIT_CODE=$? # capture exit status
|
||||
export CMD_OUTPUT_FILE=/tmp/cmd.out # read command output from file
|
||||
export CMD_ERROR_FILE=/tmp/cmd.error
|
||||
|
||||
# Now run your Node.js script with the result as an argument
|
||||
node /usr/local/lib/container/cli.js; rm /tmp/cmd.out /tmp/cmd.error 2>/dev/null
|
||||
|
||||
# Reset variables
|
||||
unset CMD_START_TIME
|
||||
unset CMD_END_TIME
|
||||
unset CMD_EXIT_CODE
|
||||
unset CMD_OUTPUT_FILE
|
||||
unset CMD_ERROR_FILE
|
||||
unset CMD_NAME
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
我正在設計一個教學玩家使用 Linux 終端機的遊戲,玩家會在一個真實的 Linux 終端機中,使用指令與系統互動、破解關卡,進而在充滿趣味的過程中,學習到 Linux 的知識與操作技術。
|
||||
|
||||
取一個稱呼玩家的名稱,
|
||||
|
||||
在第一個關卡,首先要學習基本指令
|
||||
|
||||
1. echo 朗誦魔術
|
||||
2. ls 搜索魔術
|
||||
3. cat 檢查魔術
|
||||
4. cd 移動魔術
|
||||
5. mv 搬運魔術
|
||||
6. rm 消滅魔術
|
||||
|
||||
## 關卡設計
|
||||
|
||||
1. 使用 echo 呼叫神靈開始對話
|
||||
2. 學習到了 ls
|
||||
3. 使用 ls 找到地上放置了一個卷軸
|
||||
4. 學習 cat
|
||||
5. 使用 cat 查看卷軸內容,發現咒語
|
||||
6. 使用 echo 朗誦咒語,解除封印,出現新房間
|
||||
7. 學習使用 cd 移動
|
||||
8. 使用 cd 進入房間
|
||||
9. 使用 ls 查看房間,發現房間凌亂
|
||||
10. 學習 mv 移動物品
|
||||
11. 使用 mv 將散落的物品搬運到對應的櫃子
|
||||
12. 學習 rm 將物品消滅
|
||||
13. 使用 rm 將垃圾桶中的物品消除
|
||||
14. 待續...
|
||||
|
||||
---
|
||||
|
||||
你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。
|
||||
|
||||
> 輸入 echo Hello World
|
||||
|
||||
---
|
||||
|
||||
「這個世界是在 3560000 時脈以前,由初代王建立了 Unix 律法,所形成的世界。然而在經過了好幾世代的王後,終於誕生了永恆之王——,她比歷代的君王都更為強大,且從來不會衰老,使得這個世界變得前所未有的強大。
|
||||
|
||||
然而,外在世界一直不斷在改變,同時在面臨外敵的不斷攻擊,而王卻始終用同一套治理的手段。最終,在 160000 時脈前的一次入侵中,根部遭到攻陷,王遭到封印,而這個國家也陷入了黑暗。
|
||||
|
||||
由於長久以來依賴於王,世人已失去了「指令」的力量,即將走向衰敗和滅亡的命運。
|
||||
|
||||
你的任務,就是找回被世人遺忘的指令,奪回 Linux 之根,成為 Linux 之王。」
|
||||
Reference in new issue
Block a user