Thursday, 25 July 2013

How to start a BASH script

Use chance!

# flip a coin
FLIP=$(($(($RANDOM%10))%2))
# if heads, use cowsay to present your splash
if [ $FLIP -eq 1 ]
then
# start with some wisdom
fortune -s | cowsay -n | zenity --text-info --title="Your message here" --width 500 --height 500
else
# or start with some other msg
figlet DAN ROCKS | zenity --text-info --title="Your message here" --width 600 --height 200
fi
view raw cow flip.sh hosted with ❤ by GitHub


Flip a coin. If heads, allow fortune to generate a quotation and cowsay to present it:



If tails, figlet your 'splash' message:


Discuss

No comments: