Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: echo $? in perl

by roboticus (Chancellor)
on Nov 30, 2007 at 20:59 UTC ( #654214=note: print w/ replies, xml ) Need Help??

in reply to echo $? in perl


As you were told repeatedly in the CB yesterday, your problem is that you insist on persist in using:

eval { $mov=$ssh->exec("echo $?\n","2"); }; warn $@ if $@;
instead of:
eval { $mov=$ssh->exec('echo $?\n',"2"); }; warn $@ if $@;
In the first, perl is evaluating the $? for you, so the remote machine sees something utterly different. It's seeing 'echo 0\n' instead of 'echo $?\n'. So of course you're always going to get a zero result...


Update: Upon rereading, the tone was harsher than intended.

Comment on Re: echo $? in perl
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://654214]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (14)
As of 2015-08-03 17:22 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (47 votes), past polls