Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is related to my previous question of performing commands in multiple subdirectories simultaneously.

I'd like to run a program I've copied into every subdirectory which takes *.in files in the current directory as input files. I can find the program, but how do I tell it to run when I've found it?

share|improve this question

migrated from stackoverflow.com Jul 9 '11 at 16:40

This question came from our site for professional and enthusiast programmers.

1 Answer 1

jcomeau@intrepid:/tmp$ for program in $(find . -name $PROGRAM); do
 (cd $(dirname $program) && ./$(basename $program));
done

where PROGRAM is the name of your program.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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