in reply to Re: Look for ~*/.netscape/ dirs
in thread Look for ~*/.netscape/ dirs

You missed the star after the tilde (which doesn't really work) {grin}. My solution looks in all home directories. Yours looks only in your own.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Re: Look for ~*/.netscape/ dirs
by strredwolf (Chaplain) on Apr 14, 2001 at 23:44 UTC
    From your snippet, I couldn't see if it actually did go through all the homes (getpwent's worthy, but still, where's the full search?)

    Of course, there's...

    open(IN,"</etc/passwd"); while(<IN>) { chomp; next unless(/^([^:]+):/); $names=`find ~$1/.netscape -name prefs.js -o -name liprefs.js -pri +nt`; @names=split /\n/, $names; push @files, @names; }

    --
    $Stalag99{"URL"}="http://stalag99.keenspace.com";

      Uh, getpwent returns all the info for all the users, and therefore all the homes.

      Yours fails on a system that is YP'ed, er, NIS'ed.

      -- Randal L. Schwartz, Perl hacker

        YP/NIS uses a different way of specifying users other than /etc/passwd, eh? I'm left wondering if it's part of the POSIX spec or somewhere standard....

        --
        $Stalag99{"URL"}="http://stalag99.keenspace.com";

      strredwolf:
      (getpwent's worthy, but still, where's the full search?)

      Basically, what happens is the grep tests each potential dir returned by its 2nd arg (the do block) to see if it's a directory. If it is, the entry ends up in @dirs...

      It took me ages to figure this out, so it's worthy of a repeat. :o)

      (Yes, it took 4 reads of perldoc -f grep to finally parse correctly.)

      --
      Me spell chucker work grate. Need grandma chicken.