Insert this line and the solution will reveal before your weary eyes...
Hint: You need to escape $?.print "$command ; echo COMMAND_RET:$? | sed 's/^/COMMAND_OUT: /g'; ech +o -n END_; echo EXPECT\n";
Why not get rid of the sed-invocation?
Depending on the shells flavour of echo, you could also get rid of the second echo invocation.$exp->send("$command ; echo 'COMMAND_OUT: COMMAND_RET:'\$?; echo END_E +XPECT\n");
In reply to Re: Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command
by Perlbotics
in thread Incorrect value 0 reported in command execution return value variable $?, when trying with expect->send command
by Davewhite
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |