[Omaha.pm] Help with File::Find
hostetlerm at gmail.com
Thu Nov 6 14:06:20 PST 2008
I guess I only gave you one piece of the puzzle. "ls" also errors if the
file doesn't exist and (with the way this script is written) it causes the
script to die. Using globs or File::Find prevents that from happening. Once
we find that file, then we search it for "interesting strings" and send
Very basic Perl functionality, yet the original author didn't understand
some basic concepts of Perl. Like how subroutines work, and the fact that
not all variables need to be global.
Sorta reminds me with the Perl script I ran into 15 years ago that did `grep
$str $filename` to search a file. :)
Yes, my little File::Find snippet works well! Now on to correct other sins
committed in this script.
On Thu, Nov 6, 2008 at 2:39 PM, Kevin <sharpestmarble at gmail.com> wrote:
> If "ls" is aliased to put filesizes in front, then you shouldn't count
> on ls being in /bin. Instead, you should figure out where it is.
> `which ls | grep -v alias | tr -d '\t'`
> On Thu, Nov 6, 2008 at 2:33 PM, Jay Hannah <jay at jays.net> wrote:
> > Mike Hostetler wrote:
> >> It's ironic that you put that, since that's pretty much the exact
> >> I'm replacing. :) The problem is that one some of these systems "ls" is
> >> aliases to always put filesize in front (why? I don't know -- I find it
> >> annoying).
> > You can't specify /bin/ls to avoid aliases?
> >> This is what I came up with after some googling and piecemailing.
> >> Anonymous
> >> subroutines are a good thing!
> > Yay! So you're all set? :)
> > j
> > <blasphemy>
> > I wonder if Windows PowerShell knocks this problem out of the park?
> > http://en.wikipedia.org/wiki/Windows_PowerShell
> > </blasphemy>
> > _______________________________________________
> > Omaha-pm mailing list
> > Omaha-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/omaha-pm
> Omaha-pm mailing list
> Omaha-pm at pm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Omaha-pm