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