Scripting question

Bryan Breen Bryan.C.Breen.1 at gsfc.nasa.gov
Wed Nov 6 17:01:44 PST 2002


At 13:52 11/6/02 -0600, Jim Murphy wrote:
>On Wed, Nov 06, 2002 at 01:08:51PM -0600, Archaic wrote:
>> I needed to create a file with everyday of the year in mmddyy form.
...
>Ok, so it's not bash, but it's one of the reasons I like zsh.
...
>for (( m=1; m <= 12; m++ ))
>do
>        mo=${m}
...
>        for (( d=1; d <= maxday; d++ ))
>        do
>                day=${d}
>                print ${mo}${day}${yr}
>        done
>done

He needs the months to be two digits, so you should change a little bit:

>        mo=${m}

That should become:

	if (( mo < 10 ))
	then
		mo=0${m}
	else
		mo=$m
	fi


Not sure if that's the right syntax for zsh's if-then-else, but you get the
picture.


- B

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list