I'll start off by saying I don't know much about coding. I took a couple coding classes in college but the science just wasn't for me. I do appreciate GeekTool though; all the simple code I've used I've found online. The following code is for a horizontal calendar. It worked flawlessly for the month of July but not so much for August.
Would one of you fine coders be able to help me with this?
Thanks
PHP:
#!/bin/bash
declare color="${1:-32}" d=0 yy mm dd mon day wkd dow
declare months=( 31 28 31 30 31 30 31 31 30 31 30 31 ) wkdays=( "Su" "Mo" "Tu" "We" "Th" "Fr" "Sa" )
read yy mm dd mon < <(date "+%Y %m %d %b")
[ $(( yy % 4 )) -eq 0 ] && ${months[1]}=29
wkd=$(date -jnu ${mm}010101${yy} '+%w')
mm=${months[$mm-1]}
declare line1=" " line2="\e[1;37m$mon $yy\e[0m "
while [ $(( ++d )) -le $mm ]; do
printf -v day "%02d" $d
(( dow = ( d + wkd - 1 ) % 7 ))
[ $dow -eq 0 -a $d -gt 1 ] && { line1="$line1 |"; line2="$line2 |"; }
[ "$day" == "$dd" ] && { line1="$line1\e[1;${color}m"; line2="$line2\e[1;${color}m"; }
line1="$line1 ${wkdays[$dow]}"; line2="$line2 $day"
[ "$day" == "$dd" ] && { line1="$line1\e[0m"; line2="$line2\e[0m"; }
done
printf "$line1\n$line2\n"
Would one of you fine coders be able to help me with this?
Thanks