Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
print color escapes
- X-seq: zsh-users 19644
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: print color escapes
- Date: Wed, 31 Dec 2014 21:47:44 -0800
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
All,
$ print -r "\e[36msome cyanide salts are cyan\e[0m"
\e[36msome cyanide salts are cyan\e[0m
... does as expected, but how does one achieve the same 'literalness' if
color escapes are in variables? I was forcing the 'colors' array to
print bold colors and in the process the only way I could figure out to
print the actual values of the 'fg[color]' colors was like this:
$ print -r "before $($fg[cyan]) after"
command not found: ^[[36m
... which is a bit clumsy, but it does at least show what's in there. I
tried various things, but can't find a legit way of printing the values
of the color escapes. How should it be done? Single quotes obviously
won't work, double quotes seem needed to expand the variable, but I
haven't found a way to stop it from being de-literalized. But there
will be a way. Probably some magic nesting of braces. I'd expect 'print
-r' to 'stay literal' with the expanded variable but no luck.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author