in reply to Re: How to get the exit status and the output of the command launched in perl
in thread How to get the exit status and the output of the command launched in perl
yes, but the $? in perl is different from the $? in bash.
I test the curl command in bash and in perl:
Is there a convenient way to translate it back? </code>
I test the curl command in bash and in perl:
and if I put it in perl like:[larry@august-dev perl]$ curl --max-time 3 http://someweb.org 2>&1 curl: (6) name lookup timed out [larry@august-dev perl]$ echo $? 6
then I got:#!/usr/bin/perl use strict; use warnings; my $result = `curl --max-time 3 http://someweb.org 2>&1`; print "exit status: $?\n"; print "result:\n", $result, "\n";
How does perl translate the bash $? 6 to its own $? 1536 ?[larry@august-dev perl]$ ./foo.pl exit status: 1536 result: curl: (6) name lookup timed out
Is there a convenient way to translate it back? </code>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to get the exit status and the output of the command launched in perl
by almut (Canon) on May 26, 2009 at 10:47 UTC |
In Section
Seekers of Perl Wisdom