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.


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

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.