這篇文章主要為大家展示了“shell腳本如何實現(xiàn)echo輸出不換行功能”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“shell腳本如何實現(xiàn)echo輸出不換行功能”這篇文章吧。
創(chuàng)新互聯(lián)科技有限公司專業(yè)互聯(lián)網基礎服務商,為您提供聯(lián)通機房服務器托管,高防服務器,成都IDC機房托管,成都主機托管等互聯(lián)網服務。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輸出不換行功能”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
分享名稱:shell腳本如何實現(xiàn)echo輸出不換行功能-創(chuàng)新互聯(lián)
網站地址:http://aaarwkj.com/article12/ggddc.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供標簽優(yōu)化、網站建設、網站設計公司、動態(tài)網站、微信公眾號、自適應網站
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)