How to pass arguments to program in a for loop of a shell script
I'm having a little trouble implementing a very simple shell script. I want to run a program with command line inputs 2-100 as one of the program arguments and direct the results to another 开发者_开发百科file, i.e.
for (( c=2; c<101; c++))
do
./virtmem 100 $c fifo sort2 >> results/FIFOSORT.txt
done
But this doesn't quite work because it says fifo isn't a program. Any suggestions? Thanks for your help.
What is virtmem doing with those args? If it's trying to run "fifo" as another script, perhaps fifo needs "chmod +x" to make it exec'able?
Try to either do this
`./virtmem 100 $c fifo sort2 >> results/FIFOSORT.txt
`
or this
./virtmem 100 $c "fifo" "sort2" >> results/FIFOSORT.txt
.
I think it will solve your problem.
精彩评论