简体   繁体   English

Bash命令行中的感叹号的含义

[英]Meaning of Exclamation mark in Bash command line

I have found this command online, finding and displaying hardlinks to a file eg text.txt. 我在网上找到了此命令,找到并显示了指向文件的硬链接,例如text.txt。

My question: What is the exclamation mark (!) doing in this command? 我的问题:此命令中的感叹号(!)是什么?

find $PWD ! -type d -links +1 -ls | sort -n|cut -d" " -f29 | grep --color=auto "$2"

This negates the next condition. 这将否定下一个条件。 So ! -type d 所以! -type d ! -type d means "not a directory". ! -type d表示“不是目录”。

There is one problem, though: ! 有一个问题,虽然: ! is also a special character which is used to make bash do history expansion. 也是一个特殊字符,用于使bash进行历史扩展。 That's why you often have to escape ( ... \\! ... ) or quote it ( ... "!" ... ). 这就是为什么您经常不得不转义( ... \\! ... )或引用它( ... "!" ... )的原因。

See also: The manual for find (try man find or info find ). 另请参阅: find手册(尝试man findinfo find )。

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

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