简体   繁体   English

使用文件中的参数多次执行bash脚本

[英]Executing bash script multiple times with arguments from file

I want to run a bash script multiple times with 1 argument at a time, read from a file. 我想一次从文件中读取一个参数,一次运行一个bash脚本多次。 That file contains domainnames per line. 该文件每行包含域名。 The script needs to run as many times as there are domainnames in the ARGUMENTS.txt file with 1 domainname as argument at a time. 该脚本需要运行的次数与ARGUMENTS.txt文件中域名的运行次数相同,且每次要包含1个域名作为参数。

I tried running, but this fails: 我尝试运行,但是失败了:

while read -r line; do sh SCRIPTNAME.sh "$line"; done <ARGUMENTS.txt

Any idea how this can be done? 知道如何做到这一点吗? Thanks in advance! 提前致谢!

已经发现了问题,我已经在尝试运行的脚本中使用了$ line变量...当将此变量更改为其他名称时,脚本运行得很好:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM