Codice:
#!/bin/bash
#variabili
export WHITE="\e[1;37m"
export LGRAY="\e[0;37m"
export GRAY="\e[1;30m"
export BLACK="\e[0;30m"
export RED="\e[0;31m"
export LRED="\e[1;31m"
export GREEN="\e[0;32m"
export LGREEN="\e[1;32m"
export BROWN="\e[0;33m"
export YELLOW="\e[1;33m"
export BLUE="\e[0;34m"
export LBLUE="\e[1;34m"
export PURPLE="\e[0;35m"
export PINK="\e[1;35m"
export CYAN="\e[0;36m"
export LCYAN="\e[1;36m"
export Z="\e[0m"
#stampa
echo Utilizzo:
echo echo -e \" \$VARIABILE_DEL_COLORE testo \"
echo
echo Questa e\' la lista delle variabili rappresentative dei colori
echo
echo -e " $WHITE \$WHITE $Z Bianco"
echo -e " $LGRAY \$LGRAY $Z Grigio chiaro"
echo -e " $GRAY \$GRAY $Z Grigio"
echo -e " $BLACK \$BLACK $Z Nero"
echo -e " $RED \$RED $Z Rosso"
echo -e " $LRED \$LRED $Z Rosso chiaro"
echo -e " $GREEN \$GREEN $Z Verde"
echo -e " $LGREEN \$LGREEN $Z Verde chiaro"
echo -e " $BROWN \$BROWN $Z Marrone"
echo -e " $YELLOW \$YELLOW $Z Giallo"
echo -e " $BLUE \$BLUE $Z Blu"
echo -e " $LBLUE \$LBUE $Z Blu chiaro"
echo -e " $PURPLE \$PURPLE $Z Viola"
echo -e " $PINK \$PINK $Z Rosa"
echo -e " $CYAN \$CYAN $Z Cyano"
echo -e " $LCYAN \$LCYAN $Z Cyano chiaro"
echo -e " $Z \$Z Colore di default della shell"
echo
Questo stampa la lista dei colori e la rispettiva variabile.
Per caricare all'avvio i colori dovete inserire in /etc/bash/bashrc questo:
Codice:
export WHITE="\e[1;37m"
export LGRAY="\e[0;37m"
export GRAY="\e[1;30m"
export BLACK="\e[0;30m"
export RED="\e[0;31m"
export LRED="\e[1;31m"
export GREEN="\e[0;32m"
export LGREEN="\e[1;32m"
export BROWN="\e[0;33m"
export YELLOW="\e[1;33m"
export BLUE="\e[0;34m"
export LBLUE="\e[1;34m"
export PURPLE="\e[0;35m"
export PINK="\e[1;35m"
export CYAN="\e[0;36m"
export LCYAN="\e[1;36m"
export Z="\e[0m"
una stupidaggine ma a qualcuno potrebbe servire per i propri scriptini in bash :winkOLD: