Home » Questions » Computers [ Ask a new question ]

How to make a script to invoke all others scripts matching a pattern

How to make a script to invoke all others scripts matching a pattern

I have a directory with a lot of scripts to generate figures. All the scripts match the pattern fig*-gen.sh

Asked by: Guest | Views: 53
Total answers/comments: 2
Guest [Entry]

"bash internals:

for s in fig*-gen.sh; do
bash ""$s"";
done

via (gnu)find:

find . -name ""fig*-gen.sh"" -exec bash '{}' ';'"
Guest [Entry]

"Instead of a for-loop, you can use find:

find $SCRIPT_DIR -type f -name ""fig*-gen.sh"" -exec {} \;"