Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

bala_999:

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...

...roboticus

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://654214]
help
Chatterbox?
[Corion]: :-D
[Corion]: Di-hydrogen monoxide is even worse!
choroba needs some CH3CH2OH

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2016-12-06 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (104 votes). Check out past polls.