dirtdog has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks, Does anyone know how i would capture the return code from a perl one-liner executed from a korn shell script?
perl -i.bak -pe 's/AJZ/AZZ/g if /^AB/' <filename> if [[ $? != 0 ]];then exit 1 fi
if the one-liner fails for any reason I'd like to be able to exit with a failed status from the shell, but what i have doesn't work.
any help would be greatly appreciated. thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capture error from one-liner
by choroba (Cardinal) on Sep 19, 2014 at 16:41 UTC | |
by shmem (Chancellor) on Sep 19, 2014 at 16:54 UTC | |
by choroba (Cardinal) on Sep 19, 2014 at 16:56 UTC | |
by LanX (Saint) on Sep 19, 2014 at 17:03 UTC | |
by dirtdog (Monk) on Sep 19, 2014 at 16:48 UTC | |
|
Re: Capture error from one-liner
by LanX (Saint) on Sep 19, 2014 at 16:14 UTC | |
by dirtdog (Monk) on Sep 19, 2014 at 16:26 UTC | |
by LanX (Saint) on Sep 19, 2014 at 16:32 UTC | |
|
Re: Capture error from one-liner
by Laurent_R (Canon) on Sep 19, 2014 at 17:53 UTC | |
|
Re: Capture error from one-liner
by Bloodnok (Vicar) on Sep 19, 2014 at 16:57 UTC |