Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17763

How to exit/kill remaining commands in script if......

$
0
0

scp -c arcfour source destination; echo $? if [ $?>0 ] ; then // echo 1

Above is what I have so far (this is a hook in another script) but I am looking to hand off a return code to another script. So, if the scp command fails and returns a non 0 then echo 1 and stop the remaining script from executing. Also I have many scp commands in this script, that is why after one fails I don't want it to continue. I am a fairly new admin so bare with me as my scripting isn't the best. Please provide any help. Thanks.

submitted by mikeboucher21
[link][14 comments]

Viewing all articles
Browse latest Browse all 17763

Trending Articles