Shell echo命令,shellecho命令

來源:互聯網
上載者:User

Shell echo命令,shellecho命令
顯示變數read 命令從標準輸入中讀取一行,並把輸入行的每個欄位的值指定給 shell 變數

#!/bin/shread name echo "$name It is a test"
以上代碼儲存為 test.sh,name 接收標準輸入的變數,結果將是:
[root@www ~]# sh test.shOK                     # 標準輸入OK It is a test        # 輸出
顯示換行
echo -e "OK! \n" # -e 開啟轉義echo "It it a test"
輸出結果:
OK!It it a test
顯示不換行
#!/bin/shecho -e "OK! \c" # -e 開啟轉義 \c 不換行echo "It is a test"
輸出結果:
OK! It is a test
顯示命令執行結果
echo `date`
注意: 這裡使用的是反引號 `, 而不是單引號 '。結果將顯示當前日期
2017年 08月 08日 星期二 21:08:23 CST

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.