請問在一個命令上加什麼參數能夠實現下面命令的內容在同一行輸出。 echo "zhaokang";echo "zhaokang"

請問在一個命令上加什麼參數能夠實現下面命令的內容在同一行輸出。 echo "zhaokang";echo "zhaokang"io

[root@zhaokang test]# echo "zhaokang";echo "zhaokang"
zhaokang
zhaokangtest

 

解答:總結

[root@zhaokang test]# echo -n "zhaokang";echo "zhaokang"
zhaokangzhaokang字符

 

說明:此題考察echo的-n 參數。echo的命令常常用,須要總結以下:new

echo 參數

  -n do not output the trailing newlineab

  -e enable interpretation of backslash escapes

加-n 是取消換行符

加-e參數是可使用轉義字符

[root@zhaokang test]# echo -ne "zhaokang\t";echo "zhaokang"
zhaokang        zhaokang

 

[root@zhaokang test]# echo -e "zhaokang\tguobaoyan"
zhaokang        guobaoyan

 

[root@zhaokang test]# echo -e "zhaokang\nguobaoyan"zhaokangguobaoyan

相關文章
相關標籤/搜索