I have c program that I run like this:

./a.out t1

And my test files look like this all the way up to 100:


Is there a way to run this more efficiently so I don't have to hit up and change the number every time?

  • 1
    With gnu parallel you could run parallel ./a.out ::: t{1..100} - not sure if you want to run them in parallel though... – don_crissti Feb 24 '16 at 12:36

A simple loop will do the trick:

for i in {1..100}; do ./a.out t${i}; done
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.