On Thu, 25 Jan 2001, Robert Shiels wrote:
> 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";
> }
> }
> ' $*
> }
>
Nice.
Put the function in the top of a shell script and the call it with just
rcsw at some point after that (possibly after setting an appropriate
environment ) run the shell script from cron.
/J\
--
Jonathan Stowe |
http://www.gellyfish.com | I'm with Grep on this one
http://www.tackleway.co.uk |