shell - Bash script to run several files successively -
i'm learning flex , bison , bash.
i created .exe called compiler
i have bunch of .txt files test repeatedly.
how can write script run:
./compiler test1.txt ./compiler test2.txt ...etc i don't want pass them @ once arguments. run them successively.
i wrote script.sh in same directory i'm working compiler , test files:
#!/bin/bash clear ./compiler test9.txt ./compiler test8.txt ./compiler test7.txt ./compiler test6.txt ./compiler test5.txt ./compiler test4.txt ./compiler test3.txt ./compiler test2.txt ./compiler text1.txt then did chmod u+x script.sh , tried script.sh
didn't work.
you need ./script.sh run file current directory (the same way have ./compiler).
that being said script should work fine does.
but can same thing loop well:
for file in test*.txt; ./compiler "$file" done
Comments
Post a Comment