[mdlug] Need help with bash array usage

Jeff Hanson jhansonxi at gmail.com
Wed Jul 9 18:10:55 EDT 2008


On Tue, Jul 8, 2008 at 10:34 PM, Brian <brian at dangerbacon.com> wrote:
> I suspect you're right.  Files with spaces are the bane of every shell
> script that has to deal with them.  The only trick I know of to deal with
> this type of situation is pipe your data into a while loop to keep the
> spaces from from splitting your data to separate elements.
>
> Something like this:
> find . -type f -iname '*.ext' | while read FILE_NAME; do
>   #do stuff
> done

I tested it a bit and it seems to work but would require significant
changes to my script design.  It definitely can't be used to populate
an array in my existing script as it's output still ends up loading as
a list.  I'll keep it as a backup solution.



More information about the mdlug mailing list