From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11263 invoked by alias); 1 Jan 2015 19:54:30 -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: 19646 Received: (qmail 2090 invoked from network); 1 Jan 2015 19:54:27 -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 autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=T/C1EZ6Q c=1 sm=1 tr=0 a=jwg7e+C1pu9G5Tm+CahlKw==:117 a=jwg7e+C1pu9G5Tm+CahlKw==:17 a=Hpgzp-inWqAA:10 a=N659UExz7-8A:10 a=_-8_jNDyFupuGv1-gMcA:9 a=pILNOxqGKmIA:10 Message-id: <54A59EE5.7000601@eastlink.ca> Date: Thu, 01 Jan 2015 11:24:21 -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@zsh.org Subject: Re: print color escapes References: <54A4DF80.7040206@eastlink.ca> <141231223506.ZM26289@torch.brasslantern.com> In-reply-to: <141231223506.ZM26289@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 12/31/2014 10:35 PM, Bart Schaefer wrote: > torch% print -r ${(V)fg[cyan]} > ^[[36m > torch% print -r ${(q)fg[cyan]} > $'\033'\[36m Thanks, either is usable. } 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. Ok, we hafta stop the terminal from doing it's thing when we want to 'see' the escape code without the terminal 'doing' the escape code. But why/where is the change made? I tried this script: cyan='\e[36;1m' norm='\e[0m' print "1: $fg[cyan] howdy $norm" print "2: $cyan howdy $norm" print -r "7: the value of fg[cyan] is: ${(V)fg[cyan]}" print -r "8: the value of cyan is: ${(V)cyan}" 1: howdy << nicely cyan 2: howdy << nicely cyan 7: the value of fg[cyan] is: ^[[36;1m << modified to 'bold' by me. 8: the value of cyan is: \e[36;1m ... either the " \e[ " or the " ^[[ " form produces the color change, so why does the 'color' function 'bother' to change from one form to the other, and how/where? I see the escape created like this: local lc=$'\e[' rc=m ... so how does it end up like: " ^[[ " ? BTW I know you can't type " ^[[ " and have it work, the " ^[ " represents the escape code but can't create it, so I know it's a 'safe' way of showing the code, but since both my '$cyan' and 'fg[cyan]' seem to work the same way, I'm confused as to what the point of the difference is.