From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23830 invoked by alias); 1 Jan 2015 05:48:02 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19644 Received: (qmail 15280 invoked from network); 1 Jan 2015 05:47:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_HDRS_LCASE,T_MANY_HDRS_LCASE autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=T/C1EZ6Q c=1 sm=1 tr=0 a=nZy2MyxGdNgdBo8LSjUaNA==:117 a=nZy2MyxGdNgdBo8LSjUaNA==:17 a=Hpgzp-inWqAA:10 a=IkcTkHD0fZMA:10 a=k4hMh1zw8PWXTMwpqdAA:9 a=QEXdDO2ut3YA:10 Message-id: <54A4DF80.7040206@eastlink.ca> Date: Wed, 31 Dec 2014 21:47:44 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-version: 1.0 To: Zsh Users Subject: print color escapes Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 7bit 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.