echo 指令類(lèi)似挺狰,用于字符串的輸出
語(yǔ)法:echo string
【1:普通打印】
echo "this is a string !"
【2:顯示轉(zhuǎn)譯字符】
echo "\" this is a string !"\"
【3:顯示變量】
name="xiao jiang"
echo "it is $name!"
【4:顯示換行】
echo -e "OK! \n" #開(kāi)啟轉(zhuǎn)譯
echo "it is a test !"
【5:顯示不換行】
echo -e "OK! \c" #開(kāi)啟轉(zhuǎn)譯
echo "it is a test !"
【6:顯示結(jié)果定向至文件】
echo "It is a test" > myfile
【7:顯示命令執(zhí)行結(jié)果】
echo `date`