十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要为大家展示了“shell脚本如何实现echo输出不换行功能”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“shell脚本如何实现echo输出不换行功能”这篇文章吧。
创新互联科技有限公司专业互联网基础服务商,为您提供联通机房服务器托管,高防服务器,成都IDC机房托管,成都主机托管等互联网服务。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脚本如何实现echo输出不换行功能”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!