Why not do 2>&1? Redirect stderr to stdout?
-----Original Message-----
From: exp...@li...
[mailto:exp...@li...] On Behalf Of
Ryan Allen
Sent: Thursday, June 10, 2004 9:08 PM
To: exp...@li...
Subject: [Expectperl-discuss] trapping remote shell stderr
Hello perl expect list,
Please forgive is this is totally obvious, but I've been searching books
and on-line searches way too long!
Here's my problem. I spawn a ssh session to a remote box, and run a
command. If the command is successful, I just get a new prompt, but if
it fails, the program spits out an error on STDERR. Currently,
$exp_object->exp_before(),$exp_object->match(), and my
$exp_object->exp_after() objects contain all the STDOUT info, but no
STDERR info. How does one trap the STDERR strings?
On a side note, is there a simple way to get the bash return code from a
command sent to a spawned ssh shell? Right now I'm doing a "echo $?"
and expecting "\d\r" and parsing the string in $exp_object->match();
Thanks!!
- Ryan
|