![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| passing arguments from shell to java | kenpeter | UNIX for Dummies Questions & Answers | 3 | 05-19-2008 06:54 PM |
| passing strings as arguments | iago | UNIX for Dummies Questions & Answers | 1 | 08-22-2007 10:04 AM |
| Passing arguments to a script | Kevin Pryke | Shell Programming and Scripting | 3 | 06-14-2002 09:06 AM |
| Passing arguments to an alias | pmcg | UNIX for Dummies Questions & Answers | 1 | 10-23-2001 11:15 AM |
| passing arguments | jpprial | UNIX for Dummies Questions & Answers | 4 | 04-03-2001 11:13 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Passing and using arguments in Scripts.
I am new to scripting in AIX / UNIX. I have a script that runs 4 other scripts and I want to be able to pass in a agrument that I can check before I run the next script to see if the previous script finished with no errors.
Can someone send me an example of this as I'm sure it's pretty easy to do....as long as you know how. Thanks, David.Vilmain david.vilmain@wush.com |
|
||||
|
You can check the exit code after each of the four scripts you run, from insode your main script. If the first script exits with a status of 0 then continue with the second and then check it, etc....
eg #Placing scripts to run in loop for next in `echo "script1.sh script2.sh script3.sh script4.sh"` do /path/to/$next done=$? if [ $done -ne 0 ] then echo "FAILED - $next" break fi done If you want to pass arguments to a script you can place them on the command line and capture them inside the script using the standard $1, $2 eg /path/to/script1.sh arg1 arg2 script1.sh would look like..... #!/bin/sh value1=$1 value2=$2 echo "$1 - $2" Hope this is what your after |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|