I needed a program to work out what week number it was for Radio station Log generation.... so I made this. It makes pretty boring reading...
#!/bin/bash
WEEK_NUM=`date +%V`
echo $WEEK_NUM
sleep 1
#DIV_WEEK=`expr $WEEK_NUM % 4`
#echo $DIV_WEEK
case "$WEEK_NUM" in
01) export THIS_WEEK=1
export WEEK2=2
export WEEK3=3
export WEEK4=4
export WEEK5=1
export WEEK6=2
;;
02) export THIS_WEEK=2
export WEEK2=3
export WEEK3=4
export WEEK4=1
export WEEK5=2
export WEEK6=3
;;
03) export THIS_WEEK=3
export WEEK2=4
export WEEK3=1
export WEEK4=2
export WEEK5=3
export WEEK6=4
;;
04) export THIS_WEEK=4
export WEEK2=1
export WEEK3=2
export WEEK4=3
export WEEK5=4
export WEEK6=5
;;
05) export THIS_WEEK=1
export WEEK2=2
export WEEK3=3
WEEK4=4
WEEK5=1
WEEK6=2
;;
06) export THIS_WEEK=2
export WEEK2=3
export WEEK3=4
export WEEK4=1
export WEEK5=2
export WEEK6=3
;;
07) export THIS_WEEK=3
export WEEK2=4
export WEEK3=1
export WEEK4=2
export WEEK5=3
export WEEK6=4
;;
08) export THIS_WEEK=4
export WEEK2=1
export WEEK3=2
export WEEK4=3
export WEEK5=4
export WEEK6=5
;;
09) export THIS_WEEK=1
export WEEK2=2
export WEEK3=3
export WEEK4=4
export WEEK5=1
export WEEK6=2
;;
10) THIS_WEEK=2
WEEK2=3
WEEK3=4
WEEK4=1
WEEK5=2
WEEK6=3
;;
11) THIS_WEEK=3
WEEK2=4
WEEK3=1
WEEK4=2
WEEK5=3
WEEK6=4
;;
12) THIS_WEEK=4
WEEK2=1
WEEK3=2
WEEK4=3
WEEK5=4
WEEK6=5
;;
13) THIS_WEEK=1
WEEK2=2
WEEK3=3
WEEK4=4
WEEK5=1
WEEK6=2
;;
14) THIS_WEEK=2
WEEK2=3
WEEK3=4
WEEK4=1
WEEK5=2
WEEK6=3
;;
15) THIS_WEEK=3
WEEK2=4
WEEK3=1
WEEK4=2
WEEK5=3
WEEK6=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2
WEEK4=3
WEEK5=4
WEEK6=5
;;
53) THIS_WEEK=1
WEEK2=2
WEEK3=3
WEEK4=4
WEEK5=1
WEEK6=2
;;
esac
echo 'this week is' $THIS_WEEK
echo 'week 2 is' $WEEK2
echo 'week 3 is' $WEEK3
echo 'week 4 is' $WEEK4
echo 'week 5 is' $WEEK5
echo 'week 6 is' $WEEK6
sleep 5
exit
Thursday, February 14, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment