>>>>> "Brad" == Brad Knowles <[email protected]> writes:

Brad> On Dec 9, 2010, at 5:33 PM, Randal L. Schwartz wrote:
>> Just use the shell:
>> 
>> for i in *.meta; do echo "something with $i"; done

Brad> Safer, but I believe that still blows up if there are too many
Brad> files that match the expression.

Not in any modern shell, since it isn't forking to handle the for loop.

Brad> IMO, it's better to do something like:

Brad>   cd $directory
Brad>   ls -1 | grep '\.meta$' > $tmpfile

That fails if there are newlines in the filename.  Mine doesn't.

And you've also fallen into the "ls -1 |" trap.

You don't need -1 if you're not going to the terminal.  -1 is only if
you want the non-terminal behavior (classic behavior) even if the
terminal is on stdout.

Try this:

  ls | cat

Notice?  One column.  No -1 needed.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[email protected]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
_______________________________________________
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