gl2103 has asked for the wisdom of the Perl Monks concerning the following question:

Hi everybody, I'm trying to run `rsh` command on Win box to execute
sql*plus on unix box. the return code is 256.
here is a piece of code.
is anybody knows what I'm doing wrong?
PS. rcp is running ok.
--------------------------------------
$ret=`rsh server_name.user_name "export<br>ORACLE_HOME="/path/v8.1.7" +<br>export ORACLE_SID="name"<br> /path/v8.1.7/bin/sqlplus -s xxxx/xxxx@xxxx <br> @/path/test +.sql"> /path/test.log 2>&1`;<br> $setrc=$?;<br> if ($setrc){<br> Something here;<br> Return;}

--------------------------
Result after execution:
$ret is empty
$setrc=256
-----------------------------------
Thanks in advance

Replies are listed 'Best First'.
Re: windows->unix communication
by Transient (Hermit) on Apr 27, 2005 at 12:25 UTC
    looks like you've got nested double quotes. Have you tried running it straight from the command line?

    $ret=`rsh server_name.user_name "export ORACLE_HOME='/path/v8.1.7' ; e +xport ORACLE_SID='name' ; /path/v8.1.7/bin/sqlplus -s xxxx/xxxx@xxxx +@/path/test.sql" > /path/test.log 2>&1`;
    or the like may work for you
      No. I don't have an access to win box to run from command line. The unix box is configured to accept rsh from this WIN box only.What double quotes?Which ones?
      Thanks
        If you look at my reply I replaced the internal double quotes (all except the first and last in your original post) with single quotes. That may be part of your problem. I'm not familiar with rsh in Windows, so unfortunately that's all I can think of.
Re: windows->unix communication
by Fletch (Bishop) on Apr 27, 2005 at 13:14 UTC

    You might have more luck wrapping up everything to be done on the remote side in a shell script and just running that script rather than trying to deal with quoting issues between cmd and the other side.

      Thanks.I'll try to create unix script,pass evrything to it and execute this script from Win by rsh.
Re: windows->unix communication
by jpeg (Chaplain) on Apr 27, 2005 at 14:28 UTC
    Is the script doing what it's supposed to? Does a simpler script work?

    I know you're using backticks and this shouldn't be the problem, but that '256' looks like an unsuccessful return value from system(). Can you look at the lastlog on the 'nix box and confirm success or failure of the connection attempts?

    --
    jpg