My question is simple:
$ echo "Hello!"
sh: !": event not found
What is !
in this case? I then tried echo "Match\\!"
, but that resolves to Match\\!
. How do I have to write the statement?
You can use single quotes:
echo 'Hello!'
Hello!
Otherwise in double quotes shell attempts to expand !
to an event from the history..
您可以使用set +H
关闭历史记录扩展,并使用set -H
重新启用它
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.