Scripting question

Jason Gurtz jason at tommyk.com
Wed Nov 6 12:15:37 PST 2002



> You could start by using seq for the days. (for d in $(seq 1
> 30); etc...)

Also, instead of using seperate loops to cover 30 vs. 31 vs. 28 (or 29)
day months you could use one loop for $(seq 1 12); and stick some if...
then logic in a sub loop in the middle to handle what days get created.
That way, the dates will be in order and logic can handle years which
are of the leap year variety also if need be.  Instead of hard coding
the year, use the date command piped through awk to get the current year
(assuming the date/time is set correctly on the machine)  like:  date
+%Y | awk {'print $6'}  If you need a two digit year try:  date +%y |
awk {'print $1'}  Hmm, maybe bash has built in date functions, but if it
does, I don't know them.

Cheers,

~Jason

--

-- 
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