Page 1 of 1

Script color functions

Posted: Mon 26 Apr 2010, 04:32
by jpeps
I'm sure these must be around somewhere, but in case they're not:
To load functions add ". colors" to script after saving "colors" file in $PATH. It's defaulting to black terminal background.

Code: Select all

#!/bin/sh
 
### example: echo -e $RED"Hello" 

## Black background

 export RED='\E[31;40m'
 export WHITE='\E[37;40m'
 export GREEN='\E[32;40m'
 export YELLOW='\E[33;40m'
 export MAGENTA='\E[35;40m'
 export CYAN='\E[36;40m'
 export BLACK='\E[30;40m'

## White background

# export RED='\E[31;47m'
# export WHITE='\E[37;47m'
# export GREEN='\E[32;47m'
# export YELLOW='\E[33;47m'
# export MAGENTA='\E[35;47m'
# export CYAN='\E[36;47m'
# export BLACK='\E[30;47m'


Posted: Mon 26 Apr 2010, 05:59
by 8-bit
Thank you! I have your list saved for reference.