「JOI2018」Snake Escaping 題解
阿新 • • 發佈:2022-05-05
5.特殊變數 $* 和&@和 特殊狀態變數 $$ $! $_
4.path 環境變數
set |grep ^name 以name 開頭
建立使用者
如果 登入yuchao 同時export name="helloworld"
退出yuchoa 然後再登入 就能得到這個變數
因為 登入一個使用者首先生效的是bash_profile
優先生效 ~/bash_profile
3.父子shell 面試題
呼叫shell直譯器 執行指令碼會產生子shell
test.sh usr=`whoami`
source test.sh => root
source執行 whoami 是root
而如果bash執行 whoami 是空
2.變數 作用域
變數:單引號不識別特殊語法
雙引號可以識別特殊語法
shell 執行都是 命令 + 空格 + 引數
切換shell 變數會丟失 這是本地變數
環境變數是全域性的 針對當前shell 和任何子程序
還有一箇中函式體的區域性變數
1.什麼是shell
註釋#也可以跟在程式碼後面
中文可能亂碼
shell 弱型別 語言 只有字元型別
echo $HISTSIZE
echo $HISTFILE