👤
Home Man
Search
Today's Posts
Register

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

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

👤 Login to reply

 
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
...

👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to call Oracle function with multiple arguments from shell script? Balraj Shell Programming and Scripting 2 08-29-2016 02:28 AM
How can I replicate master master and master master MySQL databse replication and HA? Palak Sharma UNIX Desktop Questions & Answers 0 05-15-2014 01: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 07:39 AM
How to call multiple variables in bash !! gnanasekar_beem Shell Programming and Scripting 3 03-18-2011 01:51 AM
Bash shells communication alohisius Shell Programming and Scripting 4 09-21-2009 01:14 PM
Interacting with two BASH shells hresquivelo Shell Programming and Scripting 4 08-08-2009 06:37 PM
Shell script to call multiple java commands vivekdn Shell Programming and Scripting 4 09-03-2008 12:28 AM
fork multiple shells amit4g Programming 3 05-01-2008 03:05 PM
Difference between ksh,bash and different shells. a25khan Answers to Frequently Asked Questions 5 12-10-2003 02:30 AM
BSD, Bash and Shells? RedVenim BSD 3 10-16-2003 09:59 AM


All times are GMT -4. The time now is 11:02 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?