Hi,

Stupid question, but a code snppet got posted to NY-PM last night, and I
wanted to play with it. The problem I have is not understanding how to add
this function (rcsw) to get it to run from cron, or indeed, to run. I've put
the code in my ~/.bashrc file, am I on the right track ?


----------------------------------------
Here's the recursive version, which has more perl.  Run
this out of cron once a week to remind you if you left any
files locked somewhere in your development tree:

rcsw()
{
  perl -MFile::Find -e '
     find(sub { push(@f, $File::Find::name) if /,v$/; }, @ARGV);
     $/ = ";";
     foreach $file (@f) {
       if (open(F, $file)) {
         while (<F>) {
           if (/locks\s+(\S+);/ && $1) { print "$file\t$1\n"; last; }
         }
         close(F);
       } else {
         warn "Could not read $file";
       }
     }
   ' $*
}

----------------------
Thanks
/Robert

Reply via email to