美文网首页
-bash: !": event not found

-bash: !": event not found

作者: beed0c3eb989 | 来源:发表于2017-06-28 15:22 被阅读0次

    出处:http://blog.csdn.net/wo541075754/article/details/51222655

    在Linux环境下执行一下代码时

    printf "The first '%s,%s!' \n" Hello world
    

    返回结果为“-bash: !”: event not found”。

    错误原因:使用printf打印“!”号时,感叹号位于单引号之内造成的。将“!”移至单引号之外,即可解决。

    在shell脚本当中如果出现此问题,加上“\”反转意符号即可解决。

    所以传入命令行参数时,如果有!需要用\!代替

    相关文章

      网友评论

          本文标题:-bash: !": event not found

          本文链接:https://www.haomeiwen.com/subject/ajpucxtx.html