如何检查目录名称是否存在于机器上的任何地方(不限于当前工作目录/子目录(?我现在正在使用 -d,但这只能让我知道该目录是否存在于我当前所在的路径中。
示例输入:
./file.sh hello
预期:
script will search through computer to see if there's a directory
anywhere named "hello" and return "yes"
这应该有效
#!/bin/bash
find / -name "$1" -type d -print
如果不从 root 运行,预计会出现很多Permission denied
错误