Checking whether call command executed properly or not

Advertisement

Rick
Guest

Checking whether call command executed properly or not

I am having s script file given as an input to WinSCP.com tool. Script file consists of few commands out of which one important command is "call". This command calls shell script which will then be executed on remote linux machine.
In case of any error in shell script, it returns non-zero value and then control is returned to the script file provided as input to WinSCP.com.
But this script continues to execute further commands as previous call command (which has now executed shell script) was successful. But it does not check whether the execution of shell script was successful or not.
I want a behaviour where that script will return with exit code non-zero whenever shell script returns with error.

I am posting here some part of my script provided to WinSCP.com
.
.
.
.
.
.
call sh script.sh
mkdir /home/user/temp
.
.
.
close
exit

So in this code i want WinSCP.com to stop execution whenever script.sh exits with non-zero return code.
How can I achieve this?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Checking whether call command executed properly or not

You can use "option batch abort" to break the script on any error.

Reply with quote

Advertisement

You can post new topics in this forum