Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: print color escapes
On Dec 31, 9:47pm, Ray Andrews wrote:
}
} tried various things, but can't find a legit way of printing the values
} of the color escapes. How should it be done?
You probably want either ${(V)fg[cyan]} or ${(q)fg[cyan]}.
torch% print -r ${(V)fg[cyan]}
^[[36m
torch% print -r ${(q)fg[cyan]}
$'\033'\[36m
} I'd expect 'print
} -r' to 'stay literal' with the expanded variable but no luck.
It is staying literal with the expanded variable. The variable has a
literal escape (ascii 033) in the value, not the string backslash e,
so print -r emits that literal escape etc. It's the terminal that
then turns that into a color, not the print command.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author