Jeff Westman wrote: > > --- SilverFox <[EMAIL PROTECTED]> wrote: >> Hey can someone help me figure out why the value of $file_exists won't >> change even when the file is mssing???? Thx. >> >> #!/usr/bin/perl -w >> $out="/home/laptop/scripts/perl/logs/resetmf.log"; >> open OUT, ">>$out" or die "Unable to open $out :$!"; >> >> @site=("Machine1","Machine2"); >> #telnet >> use Net::Telnet; >> $t = new Net::Telnet (Timeout=>10, >> Errmode=>'die', >> Prompt=>'/\$ $/i'); >> foreach (@site) { >> $t->open($_); >> $t->login('username','passwd'); >> print OUT scalar(localtime), " Conn EST: $_.\n"; >> >> >> $dir="pf/working/output/Channel_status"; >> @newdir=("/Machine1/$dir","/Machine2/$dir","/Machine9/$dir"); >> >> for($x=0; $x <= $#newdir; $x++) { >> >> >> $file_exists = $t->cmd ("perl -e 'print 1 if (-s \"$newdir[$x]\")'") or >> warn "Unable to execute: $!\n"; >> >> if ($file_exists) { >> print "Found it\n"; >> }else{ >> print "File Missing\n"; >> >> } >> } >> } >> > > When I tried to run your cmd/perl line simply to test that part, I got: > > $file_exists = $t->cmd ("ksh: syntax error: `(' unexpected > > Alternatively, you might try something simpler like: > > $file_exists = $t->cmd("test -f $newdir[$x] && print 1 || print 0"); > > > > -JW > > hmmm....I'm still getting the same results. Think it have something to do with my shell (/usr/bin/sh).
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]