Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-12-2006, 01:42 AM   #1
LQ Newbie
Registered: Oct 2006
Posts: 12

Rep: Reputation: 0
Call One shell script from another shell script

Hi Everybody

I am new for Shell scripts in Linux.

I am using Slackware Linux 10.

I have two shell scripts and from i am calling with one argument.

can you anybody tell me how I call from

Thanks in advance.
Old 10-12-2006, 02:14 AM   #2
LQ Guru
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled

Of course you need to specify the full path to if it is not in the same directory where is found.
Old 10-12-2006, 04:21 AM   #3
LQ Newbie
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for your help.

It is working if we call with out argument, but I want to pass one command line argument also release or debug

I will handle this argument in

Old 10-12-2006, 05:44 AM   #4
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
or equivalently
performs "sourcing" of the 2nd script. This is similar to including and executing the code of as if it was inside (ie if defines functions, you can source in and then use those functions in
This is not the same as just calling from (like if you were calling an executable or any
other standard command like "ls", etc).
To do that, just call with it's parameter:
/path/to/ param1 param2 ...

Make sure that
1. is executable
2. has an appropriate path (unless it's in one of the directories of $PATH)

Catching's output can be done via backticks or similar syntax. Check the man pages of your shell for syntax details.
Old 10-12-2006, 06:15 AM   #5
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350

/root/Desktop/ debug

sleep 5

/root/Desktop/ release

exit 0

if [ "$#" -eq 1 ]; then

if [ "$ARG" = "release" ]; then

echo $ARG


if [ "$ARG" = "debug" ]; then

echo $ARG

That works in my box.


Old 10-13-2006, 03:59 AM   #6
LQ Newbie
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0

Thanks for your help

Now It is working.

Thankyou once again


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Makefile call shell script thllgo Programming 4 12-28-2005 09:51 AM
Shell Script call API treotan Programming 1 08-22-2005 10:59 PM
call a c program in a shell script jagman Programming 4 04-05-2005 04:58 PM
Call a shell script from php? jharper101 Programming 2 02-15-2005 12:51 AM
My shell script can't seem to call another script kakho Programming 3 04-17-2004 09:21 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration