聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

To put Back-Quote in a string of Bash

2021-02-19 10:20 浏览: 227 次 我要评论(0 条) 字号:

It’s very simple to print a word “hello” in Bash:

echo "hello"

But how to print a word with Back-Quotes?

echo "`hello`"
# It will report error because Bash will try to run 'hello' as a command
bash: hello: command not found

There are two common solutions for this problem. One is using back-slash:

echo "`hello`"

Another is just using single quote for words:

echo '`hello`'


网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复