Perseverance pays off.
Solution to checking if a file exists is to store result in a variable before
it gets converted:
$result = sprintf("%s", $t->cmd("test -f $testFile && print 1 || print 0"));
Note: None of the following worked:
$result = ! $t->cmd( "test -f $testFile ; echo $?" );
$result
--- Jeff Westman <[EMAIL PROTECTED]> wrote:
> > my $result = ! $t->cmd( "test -f $testFile ; echo $?" );
>
> Doesnt work. (makes no difference)
In my question below, I should state that it always returns '1' irregardless
if the file exists or not
> --- "John W. Krahn" <[EMAIL PROTECTED]>
> my $result = ! $t->cmd( "test -f $testFile ; echo $?" );
Doesnt work. (makes no difference)
--- "John W. Krahn" <[EMAIL PROTECTED]> wrote:
> Jeff Westman wrote:
> >
> > How do you check if a file exists on a remote server using Net::Telnet ?
> >
> > I have tried:
> >
> > $testFile = "/tmp
Jeff Westman wrote:
>
> How do you check if a file exists on a remote server using Net::Telnet ?
>
> I have tried:
>
> $testFile = "/tmp/noFileExistsHere";
>
> $result = $t->cmd("test -f $testFile ; print $? ");
> $result = $t->cmd("test -f $testFile && print 1 || print 0");
> $result = $t->cmd
How do you check if a file exists on a remote server using Net::Telnet ?
I have tried:
$testFile = "/tmp/noFileExistsHere";
$result = $t->cmd("test -f $testFile ; print $? ");
$result = $t->cmd("test -f $testFile && print 1 || print 0");
$result = $t->cmd("if [ -f $testFile ] ;then print 1; els