Computing.Net > Forums > Unix > how to Call a shell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to Call a shell script

Reply to Message Icon

Name: Amrish
Date: August 12, 2002 at 17:06:07 Pacific
Comment:

Hello everybody,
I am wondering how to call a shell script into another script if you are working in a same directory?
Please provide examples if possible



Sponsored Link
Ads by Google

Response Number 1
Name: Sunil Jasper
Date: August 13, 2002 at 02:28:06 Pacific
Reply:

Hi Amrish
If you want to call a shell script inside a script , You can directly enter the script filename at the place where you want to execute.
For eg

fileA.sh
========
echo "Inside File A"

file2.sh
========
echo "Inside File B"

If you want to call file2.sh inside file1
do the following
fileA.sh
========
echo "Inside File A"
file2.sh


But file2.sh must have execute permission or use sh

Have a nice day
Sunil



0

Response Number 2
Name: Jerry Lemieux
Date: August 13, 2002 at 17:40:30 Pacific
Reply:

There is also:

exec fileB.sh

or

. ./fileB.sh

There are times when difference invocations are appropriate. The first example may be appropriate for a menu system where you don't want scripts calling another script from within your shell. You end up with many child shells. The second example is good for when you have a script that contains a bunch of variables that you want to maintain separate from your script. When you source them in, they become visable to your script and can be used for further processing.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Limiting Print Jobs X-windows from Win2000 to...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: how to Call a shell script

How to call other shell/awk script www.computing.net/answers/unix/how-to-call-other-shellawk-script-/5571.html

How to make a shell script that forwards www.computing.net/answers/unix/how-to-make-a-shell-script-that-forwards/1971.html

How to call unix script from pl/sql www.computing.net/answers/unix/how-to-call-unix-script-from-plsql/7767.html