sravs448 has asked for the wisdom of the Perl Monks concerning the following question:
Output isprint "Start of my code\n"; my @array = `cmd to be executed`; my $exit_status = $?; print "Exit status is : $exit_status\n"; if ( $exit_status != 0) { print "Error in executing command : $! \n"; exit; }
Desired output isStart of my code Expired or invalid session token Exit status is : 13312 Error in executing command :
Start of my code Exit status is : 13312 Error in executing command : Expired or invalid session token
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capture return value from a cmd when it errors
by Athanasius (Archbishop) on Aug 05, 2014 at 13:09 UTC | |
|
Re: Capture return value from a cmd when it errors
by mr_mischief (Monsignor) on Aug 05, 2014 at 14:13 UTC | |
|
Re: Capture return value from a cmd when it errors
by Anonymous Monk on Aug 05, 2014 at 14:18 UTC | |
|
Re: Capture return value from a cmd when it errors
by roboticus (Chancellor) on Aug 05, 2014 at 13:24 UTC | |
by sravs448 (Acolyte) on Aug 05, 2014 at 13:45 UTC | |
|
Re: Capture return value from a cmd when it errors
by Lotus1 (Vicar) on Aug 05, 2014 at 13:17 UTC | |
by sravs448 (Acolyte) on Aug 05, 2014 at 13:43 UTC |