On 07/28/2018 01:37 AM, ToddAndMargo wrote:
Hi All,
How do I get the bash return code ("$?") from
the following?
$ReturnStr = qqx ( curl $TimeOutStr -L $Url -o $FileName ).lines;
Many thanks,
-T
Followup:
This is what I came up with:
if $ProgressBar {
# This need a space ofter the qqx
# $ p6 'my $x="cat /etc/hosts; echo \$\?"; my @y = split "\n",
qqx ( $x ); say @y[@y.elems-2];'
# 0
# <blank line>
@ReturnAry = split "\n", qqx ( curl $TimeOutStr -L $Url -o
$FileName; echo \$\? );
for @ReturnAry[ 0 .. @ReturnAry.elems - 3 ] -> $Line {
$ReturnStr += $Line; }
print "\n";
$ReturnCode = @ReturnAry[ @ReturnAry.elems - 2 ];
} else {
( $ReturnStr, $ReturnCode ) = RunNoShell ( "curl $TimeOutStr -L
$Url -o $FileName" );
}
return ( $ReturnStr, $ReturnCode );