Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to bring exit status of the previous run command

Status
Not open for further replies.

turn2me5

Programmer
Joined
Feb 5, 2007
Messages
2
Location
IN
Hi,

I am working on a Perl program through which I am running required commands from a Windows machine onto Linux machines.
QTP scripts will be calling the perl script on Windows machine to execute the commands on remote Linux machine. I have used CPAN's Net::Telnet module to connect to the remote Linux machine from the Windows machine.

Now the issue I am facing is that I am not able to bring back the exit status of previously run command back to the Windows machine.

Please suggest as it is urgent..

-Saurabh
 
echo $?
on linux shows you the exit status of the command after you run it.
 
Thats right

I need to bring this status to windows machine which I am not getting how to do it....!
 
did you use errmode "return" and did you evaluate the error message given by errmsg()?
 
Run you command
$telnet->cmd("do something in linux");
then do
@exit = $telnet->cmd('echo $?');

Then @exit will have your exit code.

The errmode and the errmsg() I think is only in relation to the net::telnet session itself and will not give you any data about the command ran on the remote machine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top