[tab] 不會被理會;
[Enter] 符號,就開始執行該行命令;
\[Enter] 來延伸至下一行;
# 後面的字,全部被視為註解。
[root@linux ~]# mkdir scripts; cd scripts [root@linux scripts]# vi sh01.sh #!/bin/bash # Program: # This program is used to show "Hello World !" in screen. # History: # 2005/08/23 csie First release echo -e "Hello World ! \a \n" exit 0
#! 是用來宣告 shell 外,其他的 # 都是『註解』。
\ 跳脫字元。
\a 為警告;\n 為換行。
$? 觀察回傳值。
[root@linux scripts]# sh sh01.sh Hello World !
練習題
#!,代表註解?
$?
Next: 視 Shell 為一種程式語言
Up: Shell Scripts - 簡介與
Previous: Shell Scripts - 簡介與
Contents
2017-06-14