How to call exeute multiple bash shells from one master shell?

Tags
shell scripts

 
Thread Tools Search this Thread
# 1  
Old 04-10-2018
How to call exeute multiple bash shells from one master shell?

I have few bash shells, which i want to run sequentially,

how to create a shell file, and execute/call one after other shell file. I am very new to shell programming. Bult some and running individually and also with crontab scheduler.

never had a shell calling other shells, kindly would like to know.

./master_shell.sh (this will be the master shell file)
./shell1.sh
./shell2.sh
so on so forth upto 8 shells.

Thanks a lot for the helpful info.
# 2  
Old 04-10-2018
Well, yes, list the shell scripts, preferably with absolute paths, one after the other in the master script to have them executed sequentially. Make sure you set permissions correctly. If unsure, make up a few simple test scripts and test your setup, e.g. with the -vx options set.
# 3  
Old 04-10-2018
In it's simplest form you would put one script after the other, it's best to use full paths to avoid the script failing if you aren't in the correct directory eg:

master_shell.sh
Code:
#!/bin/sh

/usr/local/bin/shell1.sh
/usr/local/bin/shell2.sh
/usr/local/bin/shell3.sh

However typically you would want to check the exit status of each script and take appropriate action if this fails perhaps something like this:
Code:
#!/bin/sh

/usr/local/bin/shell1.sh
if [ $? -ne 0 ]
then
     echo "Shell1.sh failed exit status was: $?" >&2
     echo "script terminated" >&2
     exit 1
fi

/usr/local/bin/shell2.sh
...


|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Need Multiple checks inside if condition in a bash shell script mohtashims Shell Programming and Scripting 1 06-29-2017 10:35 AM
How to call Oracle function with multiple arguments from shell script? Balraj Shell Programming and Scripting 2 08-29-2016 03:28 AM
NIM master with multiple client subnets kaelu26 AIX 5 08-05-2014 09:46 PM
How can I replicate master master and master master MySQL databse replication and HA? Palak Sharma UNIX Desktop Questions & Answers 0 05-15-2014 02:15 AM
KSH - How to call different scripts from master scripts based on a column in an Oracle table Yoodit Shell Programming and Scripting 2 06-20-2011 08:39 AM
How to call multiple variables in bash !! gnanasekar_beem Shell Programming and Scripting 3 03-18-2011 02:51 AM
Differences in BASH and ASH shells regarding if command? Bashingaway UNIX for Dummies Questions & Answers 6 09-13-2010 06:33 PM
Bash shells communication alohisius Shell Programming and Scripting 4 09-21-2009 02:14 PM
Interacting with two BASH shells hresquivelo Shell Programming and Scripting 4 08-08-2009 07:37 PM
running Multiple terminals/shells Caradoc Shell Programming and Scripting 1 07-27-2009 09:39 AM
Shell script to call multiple java commands vivekdn Shell Programming and Scripting 4 09-03-2008 01:28 AM
fork multiple shells amit4g Programming 3 05-01-2008 04:05 PM
How to open multiple shells while the scripts keeps running. Closed_Socket UNIX for Dummies Questions & Answers 5 10-08-2006 11:06 AM
Difference between ksh,bash and different shells. a25khan Answers to Frequently Asked Questions 5 12-10-2003 03:30 AM
BSD, Bash and Shells? RedVenim BSD 3 10-16-2003 10:59 AM