Last Friday of each month: Difference between revisions

("shell bourne" -> "UNIX Shell")
Line 387:
 
=={{header|UNIX Shell}}==
Using <code>ncal</code>. Will switch to Julian calender as ncal sees fit, and will not calculate past year 9999 (you'll be to dead by then to worry about weekends anyway).
<lang bash>#!/bin/sh
 
if [ -z $1 ]; then exit 1; fi
 
# weed out multiple erros due to bad year
ncal 1 $1 > /dev/null && \
for m in 01 02 03 04 05 06 07 08 09 10 11 12; do
echo $1-$m-`ncal $m $1 | grep Fr | sed 's/.* \([0-9]\)/\1/'`
done</lang>
 
<lang bash>#!/bin/sh
Anonymous user