shell 程式設計之echo

2021-08-09 18:26:22 字數 766 閱讀 8612

echo 

"it is a test"

echo 

itis

a test

echo 

"\"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

isa test

#輸出

echo -e 

"ok! \n"

# -e 開啟轉義

echo

"it it a test"

#!/bin/sh

echo -e

"ok! \c"

# -e 開啟轉義 \c 不換行

echo

"it is a test"

echo 

"it is a test"

>

myfile

echo 

'$name\"'

echo 

`date`

shell程式設計之echo命令

shell的echo命令是用於字串的輸出,格式為 echo string 1.顯示普通字串 echo it is test 結果為 it is a test2.顯示轉義字串 echo it is a test 結果為 it is a test 3.顯示變數 bin bash read name ec...

Shell程式設計入門二 echo命令

shell的echo命令和php的echo指令類似,都是用於輸出值。我們可以使用echo實現更複雜的輸出格式控制。echo hello world echo hello world 這兩句輸出結果均為 hello world echo hello world echo hello world 這兩句...

shell程式設計之chown

語法 chown option owner group file chown option reference rfile file 描述 chown 改變指定檔案的使用者和 或組的擁有者。例如 liujl liujl rev 1 0 mycode test ls l 總用量 0 rw rw r 1...