> 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/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; else print 0; fi");
> >
> > and $result ALWAYS contains 1.
> >
> > The only way I can think of is:
> >
> > $result = $t->cmd("ls -l $testFile");
> >
> > then checking $result for an error message.
> >
> > Any better solutions?
>
> test like most command line tools returns zero for true and non-zero for
> false so try this:
>
> my $result = ! $t->cmd( "test -f $testFile ; echo $?" );
>
>
>
> John
> --
> use Perl;
> program
> fulfillment
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]