Bash 行以在文件路径中使用通配符检查文件路径是否存在
Bash line to check if a file path exists using wildcards in filepath
我正在尝试检查文件路径是否存在以及是否存在以完成 pwd
命令。如果文件路径不存在,那么我希望它中断并继续执行下一个命令。
while [ -d folder1/*/stack ]; do pwd; break; done; while [<next set of commands>]...ect
我收到 binary operator expected
错误。
您可以使用 ls。如果 ls 成功,那么 pwd 将 运行:
ls folder1/*/stack > /dev/null 2>&1 && pwd
# next command
我正在尝试检查文件路径是否存在以及是否存在以完成 pwd
命令。如果文件路径不存在,那么我希望它中断并继续执行下一个命令。
while [ -d folder1/*/stack ]; do pwd; break; done; while [<next set of commands>]...ect
我收到 binary operator expected
错误。
您可以使用 ls。如果 ls 成功,那么 pwd 将 运行:
ls folder1/*/stack > /dev/null 2>&1 && pwd
# next command