Re: shell function "_colortest"

Sven Guckes <[email protected]>
Newsgroups gmane.comp.gnu.screen
Message-ID <[email protected]>
* Gerhard Siegesmund <[email protected]> [2003-12-10 11:19]:
> >   _colortest () {
> >   ...
> >        echo -n "\033[${i}mColor ${i}\033[39;49m "
> >   ...
> >   }
>
> You need echo -en "..." here, to work correctly.
> At least if you just call it from the shell. Otherwise
> it just prints out the line with all those colorcodes.

just tried this function with bash -
and, yes, the 'e' *is* required
to expand those octal codes aka
"(backslash) escaped characters".
thanks for catching this!

never noticed because the zsh
has a built-in "echo" command:

  zsh>  which echo
  echo: shell built-in command

you see, the Z-Shell spoils me.. ;-)

Sven


=== corrected version of _colortest

_colortest () {
        echo -n TEST1:
        for i in 30 31 32 33 34 35 36 37
        do
                echo -en "\033[${i}mColor ${i}\033[39;49m "
        done
        echo
        echo -n TEST2:
        for i in 90 91 92 93 94 95 96 97
        do
                echo -en "\033[${i}mColor ${i}\033[39;49m "
        done
        echo
}

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/NhFolB/TM
---------------------------------------------------------------------~->

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.