wood burning stoves*
The moose likes Linux / UNIX and the fly likes array usage in shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "array usage in shell script" Watch "array usage in shell script" New topic
Author

array usage in shell script

ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 193
Hi,

I want to have an array containing all the sub-folder names inside /home/user.
Can anybody suggest how to do this or provide any link ?

Thanks
ajse
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Ajse,
What do you want to do with that array. In UNIX, we usually pipe the list directly to the next command.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 193
Hi Jeanne,
i want to execute a command inside a for loop from i=0 to i=arr_len-1,i.e for each element of the array.
regards,
ajse
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Like what Jeanne said, normally we pipe the list to the next command. Anyway, if you want to iterate it, you can do something like this:


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923



http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: array usage in shell script
 
Similar Threads
WA #1.....word association
How could I print names randomly?
Doubt
about array
Another 'Y' game