Assigning multiple values to a variable

Hi Guru`s,

I have to write a prog. which will traverse through diff. directories and then extract some data from files. I have written it and its working fine.
But I have tested it in 1 folder.

There are many folders and I need to loop through each of them. I am not sure abt the syntax/method of assigning multiple values to a variable and then using those values in the loop.

Eg.
folders like > cd /test/e101
cd /test/e102
cd /test/e103

I would like to define a variable say
var1 = e101,e102,e103

and then use it in loop like

cd /test/echo $var1
cd /test/echo $var1...

Please advise

There are many ways to achieve your goal, consider the following two:

var="dir1 dir2 dir3"
for dir in $var; do
    echo "$dir"
done
arr=(dir1 dir2 dir3)
n=0
while (( n < ${#arr[*]} )); do
    echo "${arr[n]}"
    ((n++))
done

Thanks tkleczek it is working fine.

I have 1 more query not sure if it would be correc to post in the same thred :

want to list only todays file
I tried with find but its not extracting the correct results.

find . -name "esin001v*" �mtime 1 �ls

Try:

find . -name "esin001v*" �mtime 1
or
find . -name "esin001v*" -ctime 1 

if you want to use ls then...
find . -name "esin001v*" -mtime 1 -type f -exec ls {} \;
Hi Rakesh,

I tried with the 3 options but results are not working...
screen shot below
(hello): ls -lrt mri001v.logl*
-rw-r--r--   1 batch    esp       349415 Jul 16 16:12 mri001v.logl1
-rw-r--r--   1 batch    esp       425837 Jul 16 16:13 mri001v.logl2
-rw-r--r--   1 batch    esp       750185 Jul 16 16:17 mri001v.logl3
(hello): find . -name "mri001v.logl*" -mtime 1
(hello):

tried with -ctime and ls also can you please have a look again