OT: Evolution signature script
Hiisi
saippua5 at gmail.com
Thu Nov 4 22:41:35 UTC 2010
Hi list!
I have created this script for my signature in evolution:
cat evolution_script
#!/bin/bash
##############################################
# This script produces fancy signatures #
# for Evolution with random animals talking #
# or thinking of different wise things. #
#____________________________________________#
# Created by Hiisi <saippua5 at gmail.com> #
##############################################
# Generate binary choice, that is, "true" or "false" value to choose
between 'cowsay' and 'cowthink' commands; 'cowsay' is default.
BINARY=2
T=1
number=$RANDOM
command="cowsay"
let "number %= $BINARY"
# Note that let "number >>= 14" gives a better random
distribution
#+ (right shifts out everything except last binary digit).
if [ "$number" -eq $T ]
then
command="cowthink"
fi
animal=(`ls /usr/share/cowsay`)
# The above command gives as an array of available animal files.
# Now we need a random int within this array length, hence the 'modulo'
operator.
# This returns the remainder of a division operation.
RANGE=${#animal[@]}
number=$RANDOM
let "number %= $RANGE"
# ^^
# Here goes html-formatting for evolution signature
echo "<div>-- </div>"
echo "<pre>"
/usr/bin/fortune linux -s | /usr/bin/$command -f ${animal[$number]}
echo "</pre>"
It's only a draft so I'm open to corrections/suggestions.
Hope you'll like it!
--
____________________________________
( Beeping is cute, if you are in the )
( office ;) )
( )
( -- Alan Cox )
------------------------------------
o
o .
.---. //
Y|o o|Y//
/_(i=i)K/
~()~*~()~
(_)-(_)
Darth
Vader
koala
More information about the users
mailing list