On 12/09/2010 12:07 PM, Randal L. Schwartz wrote:
>>>>>> "Jan" == Jan L Peterson<[email protected]>  writes:
> Jan>  (eval `ls -1 *.meta | while read m; do f=\`grep "^Filter:" $m | awk 
> '{print $2; exit}'\`; echo -n "./$f -r \`basename $m .meta\` |"; done | sed 
> -e "s/|$//"`)<  input>  output
>
> Jan>  which gets rid of the multiple "cut" commands, "head", one of the
> Jan>  nested loops, and both gratuitous uses of "cat".
>
> But still leaves the evil of "ls *wild*card*", which is almost always
> wrong, unless what you're trying to do is get the contents of many
> subdirectories whose name matches a pattern.
>
> {sigh}
>
If you're going to do such a thing I would have thought find would have 
been the better command to use, using its exec flag to make sure file 
names with spaces or other odd characters get handled correctly.

I was always taught that pushing output from ls to another command is 
wrong, wrong, wrong, and the few times I've done it in a fit of 
stupidity has always backfired on me!

Paul
_______________________________________________
Discuss mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/discuss
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to