[PATCH] Fancy rc startup style RFC

Stefan Bethke stb at lassitu.de
Tue Apr 18 21:06:35 UTC 2006


Am 18.04.2006 um 22:56 schrieb Eric Anderson:

> Anish Mistry wrote:
>>> If I could figure out how to make sh do colors, I'd do it. :)
>> Is that all? :)
>> #!/bin/sh
>> ############################################################
>> # Nico Golde <nico(at)ngolde.de> Homepage: http://www.ngolde.de
>> # Last change: Mon Feb 16 16:24:41 CET 2004
>> ############################################################
>> for attr in 0 1 4 5 7 ; do
>>     echo  
>> "----------------------------------------------------------------"
>>     printf "ESC[%s;Foreground;Background - \n" $attr
>>     for fore in 30 31 32 33 34 35 36 37; do
>>         for back in 40 41 42 43 44 45 46 47; do
>>             printf '\033[%s;%s;%sm %02s;%02s  ' $attr $fore $back  
>> $fore $back
>>         done
>>     printf '\n'
>>     done
>>     printf '\033[0m'
>> done
>
> But can you do it without the printf's?   That's the key.  We don't  
> have printf until later in the boot process..

echo -e is your friend, see sh(1).

$ echo -e '\e[0;32;46m'
gives green on cyan in my xterm.

Stefan

-- 
Stefan Bethke <stb at lassitu.de>   Fon +49 170 346 0140




More information about the freebsd-hackers mailing list