I'm using qx() to run a command on a remote windows machine through rsh. I need to access the exit code of the remote command. I followed the instructions here "Get return code and output from command in Perl", but using $?
always returns 0 - seems like it is the exit code of the rsh command instead of the command run through rsh
.
However when I use ssh, then $?
actually returns the exit code of the command run through ssh
.
So, how can I access the return value of the command run through rsh on a remote windows machine using qx ?
qx(rsh -l $username $host perl a.pl); # say I run a perl script on remote machine
my $returnValue = # need the return value of 'perl a.pl' here