rsh host -l user test -f /pathtofile/file
i got always success for the return code $?
OK the rsh command succeeded but how can i get the result of the test command?
Thanx for any input
-jens-
$ rc=`rsh tuvan 'ls nofile 2> /dev/null ; echo $?'`
$ echo $rc
rc now contains the return code of the command.
Regards,
Nick Dronen
rsh host 'test -f $MyPath/$MyFile ; echo $?'
but that does not work. Perhaps the test command on the remote does not know
the variables although they are known locally when the rsh command is started.
Can i somehow get the remote test command to check for my variables??
-jens-
Nicholas Dronen <ndr...@io.frii.com> wrote in article
<Cxmn5.414$P1k.19...@news.frii.net>...
> rsh host 'test -f $MyPath/$MyFile ; echo $?'
> but that does not work. Perhaps the test command on the remote does not know
> the variables although they are known locally when the rsh command is started.
> Can i somehow get the remote test command to check for my variables??
If the local system environment contains $MyPath and $MyFile, you
need to enclose the command in double quotes -- not single quotes --
to allow your local shell to interpolate the variables.
Regards,
Nick Dronen
Exists=`rsh host "test -f $MyPath/$MyFile ; echo $?" `
so i tried to keep that echo $? away from the main shell with again single
quotes and and and...
to no result ;)
Any idea are more than welcome
-jens-
Nicholas Dronen <ndr...@io.frii.com> wrote in article
<lhDn5.433$P1k.19...@news.frii.net>...
Hello Jens,
in a korn-shell script try the following:
rc=$(rsh host "test -f $Mypath/$Myfile && echo found || echo failed")
echo $rc
REgards,
Hartwig
h.t.h.
regards, Markus
Sent via Deja.com http://www.deja.com/
Before you buy.
Either use double quotes and escape the variables (twice) that you
don't want interpolated or switch quoting styles as appropriate.
exists=`rsh host "test -f $mypath/$myfile; echo \\$?"`
exists=`rsh host "test -f $mypath/$myfile; "'echo $?'`
Ralph.