您好,登錄后才能下訂單哦!
這篇文章主要為大家展示了“shell腳本如何實現(xiàn)echo輸出不換行功能”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“shell腳本如何實現(xiàn)echo輸出不換行功能”這篇文章吧。
There are as many ways to solve this quirky echo problem as there are pages in this book. One of my favorites is very succinct:
function echon { echo "$*" | awk '{ printf "%s" $0 }' }
You may prefer to avoid the overhead incurred when calling the awk command, however, and if you have a user-level command called printf you can use it instead:
echon() { printf "%s" "$*" }
But what if you don't have printf and you don't want to call awk? Then use the tr command:
echon() { echo "$*" | tr -d '\n' }
This method of simply chopping out the carriage return with tr is a simple and efficient solution that should be quite portable.
以上是“shell腳本如何實現(xiàn)echo輸出不換行功能”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業(yè)資訊頻道!
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。