I have some scripts setup that I would like a master script to call based on a files appearance in a directory. Basically I have what's show below.

Script A uses file a

Script B uses file b

Command C uses file c

I would like to have a master script that looks for file a and if it's there run Script A if not there skip it then proceeds through B and C. All of the files and scripts are to be located within the same directory.


1 Answer 1


To execute a shell script a.sh if file a.file exists and is a regular file, you can use this construct:

[ -f a.file ] && source a.sh

You must log in to answer this question.

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