
我有以下程式碼片段:
#!/bin/sh
if [ $1 = hi ]; then
echo 'The first argument was "hi"'
else
echo -n 'The first argument was not "hi" -- '
echo It was '"'$1'"'
fi
我不知道 else 語句中 echo 後的標誌 -n 代表什麼,有人知道答案嗎?
非常感謝!
答案1
了解 un*x 命令的選項和參數的傳統方法是使用man
(手動)命令,例如
man echo
如果您在系統上發出該命令,您應該會看到該echo
命令的描述,包括類似的內容
將 STRING 回顯到標準輸出。
-n 不輸出尾隨換行符