Help on bash script?

Giorgos Keramidas keramida at ceid.upatras.gr
Sat Aug 13 03:19:26 GMT 2005


On 2005-08-12 13:38, Benson Wong <tummytech at gmail.com> wrote:
> I prefer:
>
> for COREFILE in `find / -type f -name core -print`
> do
>   ...
> done
>
> Wouldn't that accomplish the same thing?

More or less.  Less, when the filenames are too many.  See questions
posted on this very same list about ``too many arguments''.

The ``while read line; do stuff with $line; done'' loop doesn't suffer
from the same limitation, but is a bit more expensive in terms of the
number of spawned processes and (consequently) the time it takes to run.



More information about the freebsd-questions mailing list