How do you use arrays in a shell script (korn shell on a solaris box)? Let's say, I do a ls -l and there are four files, I would get back 5 lines as
total 12
-r--r----- 1 user root 917 Aug 10 2004 file1.log
-r--r----- 1 user root 917 Aug 10 2004 file2.log
-r--r----- 1 user root 917 Aug 10 2004 file3.log
-r--r----- 1 user root 917 Aug 10 2004 file4.log
I am trying to capture the names of the files in to an array (just to try out arrays) and then display the names of the files by doing an echo ${array[0]}..., but doing something horribly wrong. How do you do this?
total 12
-r--r----- 1 user root 917 Aug 10 2004 file1.log
-r--r----- 1 user root 917 Aug 10 2004 file2.log
-r--r----- 1 user root 917 Aug 10 2004 file3.log
-r--r----- 1 user root 917 Aug 10 2004 file4.log
I am trying to capture the names of the files in to an array (just to try out arrays) and then display the names of the files by doing an echo ${array[0]}..., but doing something horribly wrong. How do you do this?