no output from perl script

Robert Silge rsilge at mac.com
Mon Apr 22 18:25:09 EST 2002


You are quite right. I fixed that up, here is the current incarnation of the
script, but still no output revealed.

Also if anyone who actually knows something about perl could tell me how to
have it reprint the first print command if a valid choice is not entered
that would be pretty slick. I could add an "exit" choice so that it would
keep giving you a chance to get it right until you type exit.

But that's not really essential. Seeing what's going on is (or at least
close to essential).

-Rob

_______________________
#!/usr/bin/perl -w

print "
Which computer do you wish to delete files from?
[Remote/Local]: ";

#The user should now type one of the above choices, running that part of the
script
$machine = <STDIN>;
chomp $machine;

if ( $machine eq "Local" )
     {
     print "
This command will DELETE EVERYTHING in Local~/Research
UNLESS it is also found in Remote~/Research.
Do you really wish to do this? [N/yes]: ";

     $answer1 = <STDIN>;
     chomp $answer1;


          if ( $answer1 eq "yes" )
         {
             print "\nOK, here we go.\n";
             `rsync -auvz --progress --delete -e ssh
Remote:/home/user/rsync-testing /home/user`
         }
          else   {
             print "\nI am NOT deleting anything from Local\n";
             }
                                }

else { print "You have not selected a valid machine. \nPlease rerun
cleansync and type in a machine name (case sensitive).\n" } ;
    

if ( $machine eq "Remote" )
     {
     print "
This command will DELETE EVERYTHING in Remote~/Research
UNLESS it is also found in Local~/Research.
Do you really wish to do this? [N/yes]: ";
     $answer2 = <STDIN>;
     chomp $answer2;

          if ( $answer2 eq "yes" )
             {
             print "\nOK, here we go. \n";
             `rsync -auvz --progress --delete -e ssh
/home/user/rsync-testing Remote:/home/user/`
             }
          else {
               print "I am NOT deleting anything from Remote \n";
               };
                         }
_____________________



On 4/22/02 6:25 PM, "Mike Rubel" <mrubel at galcit.caltech.edu> boldly
proclaimed:

> 
> Hi Robert,
> This is not directly related to your question, but I do notice one issue
> here:
> 
>> This command will DELETE EVERYTHING in Remote~/Research
>> UNLESS it is also found in Local~/Research.
> 
> ...
> 
>> if ( $answer eq "yes" ) {
>>         print "\nOK, here we go.\n";
>>         `rsync -auvz --progress --delete -e ssh
>> Remote:/home/user/rsync-testing /home/user`
>>                         }
> 
> I think you may have the order of the source and destination reversed; the
> command above will rsync from Remote:/home/user/rsync-testing to
> /home/user, deleting anything in /home/user that is not already in
> Remote:/home/user/rsync-testing.  But it sounds, from the comment above,
> like this is not what you intended to do...
> 
> Mike
> 
> 





More information about the rsync mailing list