简体   繁体   English

bash中的“ echo”和“!echo”有什么区别?

[英]Whats the difference between “echo” and “!echo” in bash?

What the difference between the command echo and !echo ? 命令echo!echo什么区别?

I think that with !echo it concatenates with the previous command but I'm not sure. 我认为使用!echo可以将它与先前的命令连接在一起,但是我不确定。

The exclamation mark can have two meanings in bash: bash中的感叹号可以有两个含义:

  1. history expansion 历史扩展

     !echo 

    would expand to the recent line starting with "echo". 将扩展到以“ echo”开头的最近一行。

  2. negation (space after ! needed) 取反( !后需要空格)

    ! echo ! echo would set $? ! echo会设置$? to 0 if the echo call was unsuccessful, or to 1 if it was successful. 如果echo调用失败,则为0;如果成功,则为1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM