Glenn,

Rather than put this out to the ast-developers list, can you please
put this on your "I get to it sometime list"  as I think this falls in
your domain. 

Enhance the printf "%T" option to able return first working day and last 
working day of a month. 

It is a very common requirement in shell scripts that automate weekly, 
monthly tasks such as backups.

Here is how I do it presently for first working day of month but it would 
be nice if it were builtin to ksh93.

#!/usr/bin/ksh93
#
#  print first working day of each month in 2008 (assume Sat, Sun are non 
working days)
#

year=2008

for month in jan feb mar apr may jun jul aug sep oct nov dec
do
    day=1
    dow=$( printf "%(%w)T" "${day} ${month} ${year}")
    (( dow == 0 )) && day=2
    (( dow == 5 )) && day=3

    printf "%(%D)T\n" "${day} ${month} ${year}"
done

Regards and Thanks

Finnbarr P. Murphy



_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to