国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Linux Shell > 正文

shell腳本echo輸出不換行功能增強實例

2020-07-27 19:01:42
字體:
來源:轉載
供稿:網友

這是第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:

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.
這個腳本很簡單,就是可以用3種不同的函數(方法)來實現,輸出后不換行。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 重庆市| 嵊州市| 富宁县| 胶南市| 河曲县| 辽中县| 西充县| 长汀县| 水城县| 华坪县| 巴彦淖尔市| 夏津县| 烟台市| 卢氏县| 五指山市| 信宜市| 淄博市| 清涧县| 上饶市| 青海省| 繁峙县| 苍南县| 饶平县| 依安县| 阳山县| 丽江市| 股票| 桓台县| 东城区| 巴青县| 乐平市| 襄垣县| 沙坪坝区| 桦南县| 错那县| 东乌珠穆沁旗| 玉树县| 讷河市| 永年县| 高雄市| 西乡县|