Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
David Kramer <david at thekramers.net> writes: > You see, the color variables are actually not inside the quotes. That > part works fine. > > The problem I'm having is the ANSI color escape codes are being printed > instead of interpreted. Your problem is that you aren't asking sed to print an escape, you're asking for either 'e' or '\e', depending on which particular example. This works, for example: esc="`printf '\033'`" random_escape="${esc}bar" sed -e 's/foo/'$random_escape'/' $ echo foobaz | sh /tmp/esctest.sh |cat -v ^[barbaz The important part is you need to generate an actual escape somehow. Further, this assumes that sed will pass that escape through unmolsted, which works for me, but may not do so for you. Here, I used printf, but you might be able to use echo, depending on your implementation. tr might work. If there's a way in sed to directly specify arbitrary escapes, I don't know what it is.
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |