echo “#!” fails — “event not found”

前端 未结 5 569
长情又很酷
长情又很酷 2020-11-22 08:30

The following fails and I don\'t understand why:

$ echo \"#!\"

the following also fails with the same error message:

$ echo         


        
5条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 08:37

    echo '#!'
    

    Basically, with double quotes (") aka "weak quoting", Bash does some wacky things with the string, like variable substitution. With single (') aka "strong quoting" the string is taken literally.

    See e.g. here for a more in-depth explanation of quoting.

提交回复
热议问题