You've got the wrong mailing list. This list is for the discussion of the
mod_perl Apache module. You probably want to contact the module author or try
comp.lang.perl.misc or comp.lang.perl.modules or comp.lang.perl.moderated. Or
maybe even www.perlmonks.org.

On 02-Aug-2000 [EMAIL PROTECTED] wrote:
> I'm using the Expect module to perform some shell commands to automate some
> processing, but for some reason I'm not able to perform an "rm" function as
> I would from a shell prompt. All I want to do is to delete all of the files
> in the directory without a prompt or without using a recursive option. The
> command I would like to execute would be like the following shell command
> for a remove of all files starting with I*, i*, x*, y*, etc. The command
> that I would normally use would be rm /directory/[Iixy]* and this works. I
> have the same code included in my script, yet the "rm" doesn't seem to want
> to execute. Note that the before buffer contains the copy and the "rm".
> 
> The files get copied without any problem and I can substitute the rm with
> another command and it seems to execute. Why is "rm" any different?
> 
> Any suggestions, comments or other would be greatly appreciated.
> 
> 
> 
> Sample Code:
> print "\n Start of the copy process $TFTPCopy --> $BackupDirectory \n\n";
> $command->debug(2); unless ($InvalidSwitch){  # Copy the files
> $CopyMembers=$TFTPCopy."[Iixyz]*";
> print $command "cp $CopyMembers $BackupDirectory\n";
> unless  ($command->expect(undef,">>>")){           # Copy failed
> 
>      print " ** \">>>\"  copy failed   \n";
>      print " BACKUP FAILED\n ";
>      die "    FATAL Error  $TFTPServer";
>      }
> }
> print "\n Delete All $CopyMembers in the $TFTPCopy directory \n ";
> print " execute the command rm $CopyMembers \r\n\r";
> unless ($InvalidSwitch){                 # Copy the files
> print  $command "rm $CopyMembers\n";          # Set the enable
> unless  ($command->expect(undef,">>>")){           # Copy failed
>                $PrintMsg1= "** Delete of members failed  \n";
>      $PrintMsg2= "Delete of the files in the $TFTPCopy Failed \n";
>           PrintFailure();                          # Print Failure Routine
>                die "    FATAL Error  $TFTPServer";
>      PrintFailure();                          # Print Failure Routine
>      }
> }
> PrintFailure();                               # Print Failure Routine
> }
> 
> "Killed after the delete \n";} # End of the CopyToBackup
> 
> 
> Diagnostic Display :
> 
> shvop701>>>shvop701>>> Start of the copy process /home/tftpuser/ -->
> /tmp/tftpbackup Beginning expect from spawn id(5).
> Accumulator: 'shvop701>>>'
> Expect timeout time: unlimited seconds.
> expect: Pty=spawn id(5), time=965236546, loop_time=undef
> Matched pattern 1 ('>>>')!
>      Before match string: 'shvop701'
>      Match string: '>>>'
>      After match string: ''
> Returning from expect successfully.
> Accumulator: ''
>  Delete All /home/tftpuser/[Iixyz]* in the /home/tftpuser/ directory
> execute the command rm /home/tftpuser/[Iixyz]*
> Beginning expect from spawn id(5).
> Accumulator: ''
> Expect timeout time: unlimited seconds.
> expect: Pty=spawn id(5), time=965236546, loop_time=undef
> expect: handle spawn id(5) ready.
> expect: read 44 byte(s) from spawn id(5).
> cp /home/tftpuser/[Iixyz]* /tmp/tftpbackup
> expect: handle spawn id(5) ready.
> expect: read 28 byte(s) from spawn id(5).
> rm /home/tftpuser/[Iixyz]*
> expect: handle spawn id(5) ready.
> expect: read 11 byte(s) from spawn id(5).
> shvop701>>>Matched pattern 1 ('>>>')!
>      Before match string: 'cp /home/tftpuser/[Iixyz]* /tmp/tftpbackup\r\nrm
> /home/tftpuser/[Iixyz]*\r\nshvop701'
>      Match string: '>>>'
>      After match string: ''
> Returning from expect successfully.
> Accumulator: ''
> 
> 
> ******************************************************
> ++++++   FAILURE of EXPECT  +++++  **
> Values of the match(>>>)
> 
> Before(cp /home/tftpuser/[Iixyz]* /tmp/tftpbackup
> rm /home/tftpuser/[Iixyz]*
> shvop701)
> 
> After()  ******************************************************
> 
> Killed before the delete

-- 
Jason Bodnar + [EMAIL PROTECTED] + Team Linux

Marge: Wow, you can't find this stuff anywhere.  Seals and Crofts, Pablo
       Cruise, Air Supply, oh, Loggins and Oates...and it's free!
 Lisa: I've never heard of these bands, Mom, what kind of music do they 
       play?
 Bart: Crap rock?
Marge: [thinking] No...
Homer: Wuss rock?
Marge: That's it!

                    Viva Ned Flanders

Reply via email to