這是第8/101個腳本
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:
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:
But what if you don't have printf and you don't want to call awk? Then use the tr command:
This method of simply chopping out the carriage return with tr is a simple and efficient solution that should be quite portable.
這個腳本很簡單,就是可以用3種不同的函數(方法)來實作,輸出後不換行。
本文轉自hb_fukua 51CTO部落格,原文連結:http://blog.51cto.com/2804976/593422,如需轉載請自行聯系原作者