我遇到了一些关于“ls”这个命令的问题
我只想打印没有隐藏或链接的目录
但是我用man ls看解释,没找到
如果有一个标志表明我可以做我想做的事......
谢谢
下面是我要解决的问题...
4. 显示可见的导出
This is two commands: The first command prints "Visible exits: "
-> It must not advance the cursor to the next line.
The second command displays the visible exits and then a period (.).
-> To prevent the linked directories contents from also displaying, you
will need a flag.
-> Several wildcard patterns will be needed.
-> The period will be the last of these patterns.
The period means the current directory. But here it will seem, to
the user, to be a period at the end of a sentence listing visible
exits.
-> You will need to use a flag to keep the output from being
sorted (otherwise the period will not stay at the end).
-> With several patterns to search, some may have no matches. That
is OK, but we don't want to see warning messages. Redirect these.
最佳答案
使用 ls -d */
。 */
是一个通配符,它扩展到当前目录中的所有目录(目录以 /
结尾)。 -d
告诉 ls
列出作为参数给出的目录名称,而不是它们的内容。
关于linux - 关于 "ls",我怎样才能只显示目录(链接目录和隐藏目录除外),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29264653/