Bash 命令行中感叹号的含义

And*_*OOS 1 bash shell command-line command-line-arguments

我在网上找到了这个命令,查找并显示文件的硬链接,例如text.txt。

我的问题:这个命令中的感叹号(!)是做什么的?

find $PWD ! -type d -links +1 -ls | sort -n|cut -d" " -f29 | grep --color=auto "$2"
Run Code Online (Sandbox Code Playgroud)

Aar*_*lla 5

这否定了下一个条件。所以! -type d意思是“不是目录”。

但有一个问题:!也是一个特殊字符,用于使 bash 进行历史扩展。这就是为什么您经常必须转义 ( ... \! ...) 或引用它 ( ... "!" ...)。

find另请参阅: (tryman find或)的手册info find