环境

csh

说明

通常我们需要使用使用shell脚本处理一些事务,每次调用shell都需要添加参数。
如果重复调用多次这个shell脚本,我们可以将参数存入指定文件,循环得到参数。

shell脚本(auto_run)

#!/bin/csh  -f

#set list file of parameter 
set parameterlst = "$1"

#loop execute run
set n=`wc -l <$parameterlst`
set i=1
while ($i <= $n)
   set line="`awk '{if (NR == $i) print}' $parameterlst`"
   ./run "${line}"  
   @ i ++
end

调用

auto_run test.lst

文件说明

  • run 将要运行的shell脚本
  • test.lst中存放run需要重复调用的参数
  • auto_run 上面建立的脚本

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-08-16
  • 2021-09-04
  • 2021-08-01
  • 2022-01-07
  • 2022-03-07
猜你喜欢
  • 2021-12-29
  • 2021-09-04
  • 2021-12-19
  • 2022-01-27
  • 2022-12-23
相关资源
相似解决方案