国产探花免费观看_亚洲丰满少妇自慰呻吟_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種不同的函數(方法)來實現,輸出后不換行。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 中牟县| 桂东县| 平利县| 尉犁县| 抚宁县| 中方县| 长春市| 沂源县| 咸丰县| 遂川县| 凉城县| 鹿邑县| 长岭县| 施甸县| 治多县| 金乡县| 泉州市| 石渠县| 哈密市| 遂川县| 喀喇沁旗| 绥棱县| 当涂县| 永德县| 日喀则市| 安阳市| 孝昌县| 哈尔滨市| 城市| 贵德县| 东乌珠穆沁旗| 桐城市| 邛崃市| 沙坪坝区| 镶黄旗| 娄烦县| 娱乐| 张掖市| 当阳市| 肇庆市| 兰溪市|