how to exit out of the calling Shell Script
I have 2 shell scripts, script1.sh and script2.sh. I call script2.sh from within script1.sh ( by simple ./script2.sh command).
Based on some condition, i use exit 0 to exit out of script2.sh. I was trying to find if i can exit out of script1.sh as well at once.
Can anyone please clarify, if there is a way to do that.
below is the example
echo "Before ..."
echo "After ..."
# check if a file exists and is not empty, if not empty exit (but i want to exit out of script1 as well )
if [[ -s err.log ]]; then
echo " There was problem file is empty "
echo " The Script will Exit. Please fix the issue and run again..."
echo " file is Empty. Proceeding with the next step... "
When i execute below is the output
There was problem file is empty
The Script will Exit. Please fix the issue and run again...
I am trying to exit out of script1.sh as well so that i dont print "After ..."
thanks for the help
A little add-on to the catkin's solution: script2.sh should return a status code different from 0, otherwise script1.sh will receive a "success" status:
|All times are GMT -5. The time now is 09:53 PM.|