我想运行一个脚本,该脚本将从两个文件中获取输入以安装多个目录。
目标是:
#mount 'line 1 from file 1' 'line 1 from file 2'
#mount 'line 2 from file 1' 'line 2 from file 2'
#mount 'line 3 from file 1' 'line 3 from file 2'
#mount 'line 4 from file 1' 'line 4 from file 2'
依此类推,直到第 100 行。
我怎样才能在脚本中做到这一点?
答案1
您可以使用粘贴来完成此操作。
while read a b ; do mount "$a" "$b" ; done < <(paste file1 file2)
答案2
paste file1 file2 | head -n100 | while read arg1 arg2; do mount "$arg1" "$arg2"; done