Results 1 to 3 of 3
Hi
I am having a sh file which in turn has calls to many other sh files and all the calls are followed by an echo to check the control ...
- 01-20-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 2
problem with the echo command
Hi
I am having a sh file which in turn has calls to many other sh files and all the calls are followed by an echo to check the control flow.The problem is that even if an exception occurs in any of the script file execution , the original script file(the caller script ) continues execution.
Example
Line 1 : Echo "executing script A.sh for stopping process1"
line 2: $<path>/A.sh
Line 3: Echo "Executing script B.sh to stop process 2"
Line 4: $<path>/A.sh
line 5: Echo "Script execution succcessfull"
So in this case if an error occurs in line 4, then would line 5 still go and print that script executed sucessfully.
So cant i make sure that if any of the scripts that i called inside this script failed then i should not continue executing the parent script, should i go for exclusive conditions checks to ascertain the same.
- 01-20-2009 #2Just Joined!
- Join Date
- Aug 2007
- Posts
- 5
Hi Raj,
try to put the child script runs in some conditions, fe :
if /tmp/a.sh ;then
echo "ok"
else
echo "a failed "
exit 1
fi
then you can put exit in the condition if you want also the master process script to end or any other action.
- 01-21-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 2
Usage of nohup in an if condition
Hi
I have to use nohup along with the sh script.
How can i use if condition also in this.
The original line is script is
nohup $Start_NODEM > $Start_NODEM.out &
where Start_NODEM =$INSTALL_DIR/A.sh
have to make it similar to the one below:
if /tmp/a.sh ;then
echo "ok"
else
echo "a failed "
exit 1
fi
Thanks
Praveen


Reply With Quote