回声换行抑制 [英] echo newline suppression

查看:62
本文介绍了回声换行抑制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么$echo '-n'不在终端上写-n,尽管-n写在单引号内?

Why doesn't $echo '-n' write -n on terminal although -n is written within single quotes ?

推荐答案

因为引号由外壳处理,并且echo命令接收普通的-n.如果您想回显-n,则可以例如printf '%s\n' -n

Because the quotes are processed by the shell and the echo command receives plain -n. If you want to echo -n, you can e.g. printf '%s\n' -n

这篇关于回声换行抑制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆