I am trying to iterate over directories matching a pattern. This works great on the command line. But does not work in Shell script. Any idea?
for dirs in /var/www/html/my.domain.com/v*; do echo $dirs; done;
The above commands list
/var/www/html/my.domain.com/v1.0 /var/www/html/my.domain.com/v1.2 /var/www/html/my.domain.com/v2.0
Here is the shell script version. Does not work:
dirs=/var/www/html/my.domain.com/v* for dir in $dirs do echo "$dir" done
Tried this too:
dirs=`/var/www/html/my.domain.com/v*` #back quotes for dir in $dirs do echo "$dir" done
source share