当我在bash shell (5.1.8(1))的主目录中使用ls [A-Z]*时,它不仅会显示主目录中的文件,还会显示子文件夹中的文件。为什么会这样?有没有办法抑制这种行为?
发布于 2021-11-04 08:43:53
目录中的Bash全局范围显示子目录的内容
不,ls命令会显示子目录的内容。
为什么会这样?
因为这就是ls在给定目录名时所做的事情,所以它会显示目录内容。
有没有办法抑制这种行为?
来自man ls
-d, --directory
list directories themselves, not their contents只有ls -d。
https://stackoverflow.com/questions/69836424
复制相似问题