Script

どっか妥当なページを見つけられなかった/妥当なWikiページ名を思いつかなかった

WIP あと だれか たのむ 使い方:sh makecal.sh 5

#!/bin/sh
# makecal.sh
#set -x
# TODO: argument check
week=`date -d $1/1 +%w`
# TODO:Feb? leap year?  
if [ $1 -eq 2 -o $1 -eq 4 -o $1 -eq 6 -o $1 -eq 9 -o $1 -eq 11 ]  
then
   lastday=30
else
   lastday=31
fi
#echo $week
#echo $lastday
count=0
while [ $count -lt $lastday ]
do
   count=`expr $count + 1`
   if [ $week -eq 0 ]
   then
           weekname="日"
           color="#FFD1CC"
   elif [ $week -eq 1 ]
   then
           weekname="月"
           color=""
   elif [ $week -eq 2 ]
   then
           weekname="火"
   elif [ $week -eq 3 ]
   then
           weekname="水"
   elif [ $week -eq 4 ]
   then
           weekname="木"
   elif [ $week -eq 5 ]
   then
           weekname="金"
   elif [ $week -eq 6 ]
   then
           weekname="土"
           color="#D5EDED"
   fi
   week=`expr \( $week + 1 \) % 7`
        
   echo "||<:>$count||<:$color>$weekname|| ||"
done


Category読み物

Naoaki Iwakiri/Script (最終更新日時 2011-04-29 02:39:49 更新者 Naoaki Iwakiri)