Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command

by Perlbotics (Canon)
on Feb 25, 2012 at 14:20 UTC ( #956117=note: print w/replies, xml ) Need Help??


in reply to Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command

Insert this line and the solution will reveal before your weary eyes...

print "$command ; echo COMMAND_RET:$? | sed 's/^/COMMAND_OUT: /g'; ech +o -n END_; echo EXPECT\n";
Hint: You need to escape $?.

Why not get rid of the sed-invocation?

$exp->send("$command ; echo 'COMMAND_OUT: COMMAND_RET:'\$?; echo END_E +XPECT\n");
Depending on the shells flavour of echo, you could also get rid of the second echo invocation.

  • Comment on Re: Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command
by Davewhite (Acolyte) on Feb 27, 2012 at 07:14 UTC

    Thanks a lot for the guidance. It's working as per your suggestion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://956117]
help
Chatterbox?
[ambrus]: ah, it's one of thos
[Eily]: what, there's a difference between proof of concept and production?
[LanX]: 20 years ago traders were complaining about the latency of the trading system...
[ambrus]: I'm currently in the process of rewriting my proof of concept programs. They sort of developped organically as I was experimenting, so now I've got an ugly mess of multiple programs and one-liners held together by nothing. I'll have to rewrite them to som
[ambrus]: ething that's both cleanly organized and mostly automated.
LanX in train, bad connection
[Corion]: ambrus: Yeah - we're in that situation too, except that there is no time to do the reorganizing :-/
[LanX]: ... so my boss started a project with the newest sun servers and invited the traders to come on weekend to test it... and they were so pleased, that they forced him to keep it in production...
[ambrus]: Corion: sure, this is the long-term plan. The short term is that I have to run this ungodly mess to get results from the new input data today.
[Corion]: ambrus: Most of our "automation" is tied to process exit codes and a shell pipeline :-\

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (16)
As of 2017-03-29 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (350 votes). Check out past polls.