Linux命令之感叹号 !
生活随笔
收集整理的這篇文章主要介紹了
Linux命令之感叹号 !
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
剛才輸入命令 echo "This is file content, over!" > filename 竟然會(huì)出錯(cuò),提示:
bash: ?!": event not found
原來字符串中的!會(huì)被解析。如果不出錯(cuò)的話呢,轉(zhuǎn)義!就可以了,如 \! ,
或者把雙引號(hào)改成單引號(hào)也行。
Google了下錯(cuò)誤信息,找到如下內(nèi)容:
Message bash:?!__:?event?not?foundNotes ?When you type a word preceeded by an "!", bash thinks you want to recall a previous command or "event". The message indicates no matching event was found in your recent command history. You can suppress the special meaning of ! by quoting it, for example: \!
這段英文的大概意思就是說 !的作用就是調(diào)用之前的命令或事件。 比如?我之前輸入了一條命令?touch?aaa?bbb ,然后又刪了?rm?aaa?bbb,如果我又想重新創(chuàng)建文件aaa?bbb?我直接輸入?!touch?就可以了,該命令就會(huì)重復(fù)執(zhí)行上一次touch命令,即touch?aaa?bbb? 參考文獻(xiàn):? http://zotline.com/shownote.zot/NoteNum/3801.html
轉(zhuǎn)載于:https://www.cnblogs.com/realwall/archive/2011/11/21/2257434.html
總結(jié)
以上是生活随笔為你收集整理的Linux命令之感叹号 !的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 继续更新,关于MFC琐碎思索
- 下一篇: linux gcc编译C程序 分享