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 one.sh and two.sh from one.sh i am calling two.sh with one argument. can you anybody tell me how I call two.sh from one.sh. Thanks in advance. Sundaram.V |
Try
. two.sh Of course you need to specify the full path to two.sh if it is not in the same directory where one.sh is found. |
Thanks for your help.
It is working if we call with out argument, but I want to pass one command line argument also two.sh release or two.sh debug I will handle this argument in two.sh. Thanks Sundaram.V |
. two.sh
or equivalently source two.sh performs "sourcing" of the 2nd script. This is similar to including and executing the code of two.sh as if it was inside one.sh (ie if two.sh defines functions, you can source two.sh in one.sh and then use those functions in one.sh). This is not the same as just calling two.sh from one.sh (like if you were calling an executable or any other standard command like "ls", etc). To do that, just call two.sh with it's parameter: /path/to/two.sh param1 param2 ... Make sure that two.sh 1. is executable 2. has an appropriate path (unless it's in one of the directories of $PATH) Catching two.sh's output can be done via backticks or similar syntax. Check the man pages of your shell for syntax details. |
one.sh
Code:
#!/bin/bash Code:
#!/bin/bash Cheers ////// |
Thanks
Thanks for your help
Now It is working. Thankyou once again |
All times are GMT -5. The time now is 11:49 PM. |