我正在尝试编写一个if语句来测试是否有任何文件匹配某个模式。如果目录中有文本文件,它应该运行给定的脚本。
if
我目前的代码:
if [ -f /*.txt ]; then ./script fi
请给出一些想法;如果.txt目录中有一个,我只想运行脚本。
.txt
shell shell-script wildcards files test
files ×1
shell ×1
shell-script ×1
test ×1
wildcards ×1