1.: Put your code in code tags (select it and use the '#' button).
2.: What isn't working? error? output?
2.: What is the desired effect of your script?
3.: What values do you want to give to your $var?
Or you can use the while loop.
In my Bash shell, for example -
$
$
$ day=1
$ while [ $day -le 31 ]; do
> var=`printf "%02d/Mar/2010\n" $day`
> echo "Usage for the date: $var"
> day=`expr $day + 1`
> done
Usage for the date: 01/Mar/2010
Usage for the date: 02/Mar/2010
Usage for the date: 03/Mar/2010
Usage for the date: 04/Mar/2010
Usage for the date: 05/Mar/2010
Usage for the date: 06/Mar/2010
Usage for the date: 07/Mar/2010
Usage for the date: 08/Mar/2010
Usage for the date: 09/Mar/2010
Usage for the date: 10/Mar/2010
Usage for the date: 11/Mar/2010
Usage for the date: 12/Mar/2010
Usage for the date: 13/Mar/2010
Usage for the date: 14/Mar/2010
Usage for the date: 15/Mar/2010
Usage for the date: 16/Mar/2010
Usage for the date: 17/Mar/2010
Usage for the date: 18/Mar/2010
Usage for the date: 19/Mar/2010
Usage for the date: 20/Mar/2010
Usage for the date: 21/Mar/2010
Usage for the date: 22/Mar/2010
Usage for the date: 23/Mar/2010
Usage for the date: 24/Mar/2010
Usage for the date: 25/Mar/2010
Usage for the date: 26/Mar/2010
Usage for the date: 27/Mar/2010
Usage for the date: 28/Mar/2010
Usage for the date: 29/Mar/2010
Usage for the date: 30/Mar/2010
Usage for the date: 31/Mar/2010
$
$
Double braces expansion is similar to a nested loop. This is not a great shortcuts for dates, however, since there are different number of days per month.
Single brace expansion is a great shortcut for this though:
$ # First day of every month in 2010:
$ for var in {1..12}; do echo -n "$var/1/2010 "; done
1/1/2010 2/1/2010 3/1/2010 4/1/2010 5/1/2010 6/1/2010 7/1/2010 8/1/2010 9/1/2010 10/1/2010 11/1/2010 12/1/2010
or this:
$ # Every day in March 2010 (US Style...)
$ for var in {1..31}; do echo "3/$var/2010 "; done
3/1/2010
3/2/2010
3/3/2010
3/4/2010
3/5/2010
3/6/2010
3/7/2010
3/8/2010
3/9/2010
3/10/2010
3/11/2010
3/12/2010
3/13/2010
3/14/2010
3/15/2010
3/16/2010
3/17/2010
3/18/2010
3/19/2010
3/20/2010
3/21/2010
3/22/2010
3/23/2010
3/24/2010
3/25/2010
3/26/2010
3/27/2010
3/28/2010
3/29/2010
3/30/2010
3/31/2010