我.sh在一个文件夹中有很多脚本,并希望一个接一个地运行它们.单个脚本可以执行为:
bash wget-some_long_number.sh -H
假设我的目录是 /dat/dat1/files
我怎么能bash wget-some_long_number.sh -H一个接一个地跑?
我理解这些内容应该有效:
for i in *.sh;...do ....; done 
Kir*_*gin 21
试试这个:
for f in *.sh; do  # or wget-*.sh instead of *.sh
  bash "$f" -H 
done
它要运行,例如x1.sh,x2.sh,..., x10.sh:
for f in *.sh; do
  bash "$f" -H || break  # execute successfully or break
  # Or more explicitly: if this execution fails, then stop the `for`:
  # if ! bash "$f" -H; then break; fi
done
小智 17
有一种更简单的方法,您可以使用run-parts将执行该文件夹中所有脚本的命令:
run-parts /path/to/folder
| 归档时间: | 
 | 
| 查看次数: | 14989 次 | 
| 最近记录: |