Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .