COOL: print random calendar quote on startup!!!

dani++

usin UNIX since '92
Hi,


shell code snippet, place on '.login' file and enjoy!!!

# print a random calendar quote (using today's date)
set n_ = `ls /usr/share/calendar/ | wc -w`
set rand_ = `jot -r 1 1 $n_`
set cal_file = /usr/share/calendar/`ls /usr/share/calendar/ | cat | head -$rand_ | tail -1`
calendar -f $cal_file
unset n_
unset rand_
unset cal_file

Cool! As random engine I use 'jot', but a better engine could be used. Some calendars do not have quotes for all days, so sometimes no quote is shown, you could easily extend it to do a loop until some quote is actually shown.

Dani++
 
Back
Top