For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2007 > Re: Need to break a string "Hello1 Hello2 Hello3 Hello4 ..." into an array









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Need to break a string "Hello1 Hello2 Hello3 Hello4 ..." into an array
Ulrich Eckhardt

2007-07-19, 7:09 pm

Lucky7 wrote:
> I have just started exploring bash. I need to cut the set of words
> into an array of elements.
> e.g.
>
> File_NAME=`find .`
>
> The command returns a string with all the filenames concatenated. Now
> i want to get each of the file separately for processing.


Doesn't work, filenames can contain spaces. Instead look at the '-exec'
option of the find program.

> Also, i don't want to use a for loop. Can you please help me with a
> way to achieve this.


Preferences in loop forms are not a case where personal taste is usually
given much consideration, rather technical merits are deemed important. Why
don't you want a for-loop?

Uli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com