Aleatoria X Virtual Terminal exDebian

Aleatoria X Virtual Terminal

Solapas principales

Nombre: Aleatoria X Virtual Terminal
Autor: ihuhnix
Origen: original
Lenguaje: bash
Licencia: GPL
Propósito: Mostrar una xvt con color aleatorio.
Dependencias: date, urxvt

<strong>Código:</strong>
#!/bin/sh
t=/usr/bin/urxvt
n=`/bin/date +'%S'| cut -b 2`
if [ $n = 0 ]; then
$t -fg white
elif [ $n = 1 ]; then
$t -fg black -bg white
elif [ $n = 2 ]; then
$t -fg yellow
elif [ $n = 3 ]; then
$t -fg \#2499ff
elif [ $n = 4 ]; then
$t -fg white -bg blue
elif [ $n = 5 ]; then
$t -fg green
elif [ $n = 6 ]; then
$t -fg gold
elif [ $n = 7 ]; then
$t -fg orchid
elif [ $n = 8 ]; then
$t -fg \#C685FF
elif [ $n = 9 ]; then
$t -fg \#90EE90
fi

Ejemplos de uso:
Asociándolo a un menú como el de openbox o a un icono como el del panel de gnome.
Comentarios: Simple pero gracioso.

Me gusta este script por la forma tan sencilla de obtener un número aleatorio entre 0 y 9. He visto funciones que leen de /dev/random pero me parecen demasiado liosas para el propósito de este script.