
Greet
By: a guest on
May 8th, 2012 | syntax:
Bash | size: 0.37 KB | hits: 14 | expires: Never
#!/bin/bash
COW_PATH=/usr/share/cows
files=($COW_PATH/*.cow) # Ought to figure this array thing out.
N=${#files[@]}
((N=RANDOM%N))
cow=${files[$N]}
h=`date +%H`
case $h in
0[0-9]|1[0-1]) greeting="Good morning!"
;;
1[2-9]) greeting="Good afternoon!"
;;
2[0-4]) greeting="Good evening!"
;;
esac
cowsay -f $cow $greeting
exit 0