regular expression go into a folder

Hi Everyone,

I have two folders /root/jul/a.txt and /root/july/a.txt. I have $month="jul", so use this methold, i only can go into the first folder. is there any way, i can do like $month="jul*", means can go to both folders? becuase the month folder, sometimes is jul, or july, or nov, november, or nove, or even NOVE, NOV. How to handle this case. :confused:

Thanks

You can't go to "two folders", because you can only be at one place at a time - thats true for physics as well as Unix. ;-))

What you can do is to go to one folder after the other. Here is an example script:

#!/bin/ksh

month="jul"
dir=""

ls -ld "/root/${month}*" | while read dir ; do
     cd "$dir"
     print - "now in directory: $PWD"
     ls -l
     print - "---------------"
     cd -
done

I hope this helps.

bakunin