[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Help with File::Find



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 emails out.

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@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@jays.net> wrote:
> Mike Hostetler wrote:
>>
>> It's ironic that you put that, since that's pretty much the exact command
>> 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@pm.org
> http://mail.pm.org/mailman/listinfo/omaha-pm
>
_______________________________________________
Omaha-pm mailing list
Omaha-pm@pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm



--
Mike Hostetler
http://mike.hostetlerhome.com/