echo"it is a test
"這裡的雙引號完全可以省略,以下命令與上面例項效果一致:
echo it is a test
echo"\"it is a test\"
"結果將是:
"it is a test
"同樣,雙引號也可以省略
read 命令從標準輸入中讀取一行,並把輸入行的每個欄位的值指定給 shell 變數#!/bin/sh
read name
echo
"$name it is a test
"
以上**儲存為 test.sh,name 接收標準輸入的變數,結果將是:
[root@www ~]# sh test.sh
ok #標準輸入
ok it is a test #輸出
echo -e "ok! \n
" # -e 開啟轉義
echo
"it it a test
"
輸出結果:ok!it it a test
#!/bin/sh\a 發出警告聲;echo -e "
ok! \c
" # -e 開啟轉義 \c 不換行
echo
"it is a test
"輸出結果:ok! it is a test
\b 刪除前乙個字元;
\c 最後不加上換行符號;
\f 換行但游標仍舊停留在原來的位置;
\n 換行且游標移至行首;
\r 游標移至行首,但不換行;
\t 插入tab;
\v 與\f相同;
\\ 插入\字元;
\nnn 插入nnn(八進位制)所代表的ascii字元;
echo"it is a test
" > myfile
echo'$name\"
'輸出結果:
$name\
"
echo `date`結果將顯示當前日期
thu jul
2410:08:46 cst 2014
linux echo命令詳解
linux echo命令詳解 功能說明 顯示文字。語 法 echo ne 字串 或 echo help version 補充說明 echo會將輸入的字串送往標準輸出。輸出的字串間以空白字元隔開,並在最後加上換行號。參 數 n 不要在最後自動換行 e 若字串中出現以下字元,則特別加以處理,而不會將它當...
linux echo命令詳解
話不多說,上命令 1 用於輸出 root 192 168 2 250 echo 123 1232 echo n 表示不換行 3 ccho e 輸出轉義字元,以 t 為例 在 b後面有字元的情況下相當於刪除前乙個字元,b b相當於刪除兩個字元 123in 123覆蓋了adm root 192 168 ...
Linux echo命令用法
shell 的 echo 指令與 php 的 echo 指令類似,都是用於字串的輸出。命令格式 echo string您可以使用echo實現更複雜的輸出格式控制。1.顯示普通字串 echo it is a test 這裡的雙引號完全可以省略,以下命令與上面例項效果一致 echo it is a te...