From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, MIME_HTML_MOSTLY,RCVD_IN_DNSWL_MED,T_KAM_HTML_FONT_INVALID autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id B073A22642 for ; Sat, 11 May 2024 02:55:33 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715388933; b=nIfHkDG32BdwHNi/q8aGHY4ghngSufpIpSn9gxFOMUQH88KgMLqv+Zi/nxx/+T8SFoF4E6sJfq aQtD+srl0O/XV3ipwy7dSC9hC+gbCYomoh1e9wkW1wPn1c/fKv4VbKh36YG2nki4WZBsuy2+X3 kLW9DwsNcCnoyrq4ii1Ra6hxUGfBjucSHFZ1tFU31z9cUjlOVqej+2+nHzbXXssreM6ocj3NMl hY22AVH11ReFEGG5YikJ//yW+MHpkQVtUywsNBkGDejiXGhc3KFRIQ/nG7YqgxykpT5ySYF5lu Fi8B+vfAGbQfWt/t40EGsb1GKH2RVHQfJT4zccbJNhEWCw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f48.google.com) smtp.remote-ip=209.85.210.48; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1715388933; bh=wwXZiTUYUqRzLqf105kFVwHOCCmq3BxZAntMyO3rGls=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Subject:From:To:MIME-Version:Date:Message-ID:Content-Type: DKIM-Signature:DKIM-Signature; b=rKMvGkMYPIzFg3kc1dylMsgDPZ6M1YXbO4eDq3QI/Y1+5BD3cmrbwVHXWEi2kqeDeE0mNAsMXZ 72jfBp7bHkmAAOzZxR0kEnc2WKH4OVXC7e4wJQmrVCv5VzlVxFBx+UHC+E6Jq1V8IslvU1lDRl Qqo+wEWfPGVLTlRBWlSvHvbxbgfQe1CZxCGDUHV2FcMQu0+3cXcrHIfa4pVZB5nrNvHD0dLN3d n9BhvNrnmVlzd3DJyPLWU/n26HiGhDn5NPWq9mbUXaCMM0ON/4a01KzJDPCFAia49rzKmQq2og OnzOFTakcWfHWHdWfV9Qqe8D0W00yPaoLfDrbGJAWPOS8A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Subject:From:To:MIME-Version:Date: Message-ID:Content-Type:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=QVtmfCdJm149+4dnQOscOg9BtOrmiPovr2T3STn3bXs=; b=rDI0rRQJwwpYR4RrFBQCe5oe7t bc5tE7vp7MOJrGNrH84eUO8LZa5qFeT76+Z9ltWEEnFvKseJn1zB80Ce2yooeM22nq7Ysxe/HUh9i Ln0d6iYDJUldryQhMXkKQm4fB7C7BGs/mAUshobhq1G8VtkxFJZxUoGDVWoYG9g59qI1zH+ID9GDv KVUQEEoudslDVWsn3j02DOhcdXCN/0H0jpfnawdGNGNgPqblJKZ13kHuE5pUj+Sc3BU8SWVUpY2qU TFc1T+oyLvZ8o2EXu3tvon2EVOg/0BLiOcuRGL+O2B/8hef4bFJEV4aPzG7UrMe1RL+s3WPWKpKIt kIHWaoKQ==; Received: by zero.zsh.org with local id 1s5b1O-0003zd-U7; Sat, 11 May 2024 00:55:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f48.google.com) smtp.remote-ip=209.85.210.48; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ot1-f48.google.com ([209.85.210.48]:61518) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s5ayA-0003DV-FP; Sat, 11 May 2024 00:52:12 +0000 Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6f0794fdb95so1715561a34.2 for ; Fri, 10 May 2024 17:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715388729; x=1715993529; darn=zsh.org; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=QVtmfCdJm149+4dnQOscOg9BtOrmiPovr2T3STn3bXs=; b=Sy4D1mPlzbull4kjIiMEq0otKlMSt21dmfVX/zfho4jEf8NiWnhMT51Ieuz3QQtw8Q mWAKRt0yFfOrQBF3DCH3qZeMBN2fPjr5DlWxU8pTcaWFEioL6/0i60IKd5QM1fl3ihZf F3Z1XgJAJ3PK1yP+NiqHOnF1XSw/mEyl7bY7WcTd/Z/PzQ8fnQsAtr5IBGgvk30DG9hf bh93h0602hfdW0pOou3cEWwbwbMAPGRxWdCvvCSvaq34kqC83VYazJByo6gsYqMOzD79 GUPEFdj3pOssmHiXARpTMA9QPpCNbMFruCk0x9A9nSkgZkcKTVC0zg6dRSZfnmjsidq6 jJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715388729; x=1715993529; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QVtmfCdJm149+4dnQOscOg9BtOrmiPovr2T3STn3bXs=; b=FFWj8Y+LrIwHUBY3Jqdcf48HAuXttgQ5TaUGsVEigyRzs8/sWaTf/YYqgEVcrjoBVs +qDBh2rVMF1iOvM8GIHR7qOy7TSrYt5avgiRBX868ZYiyxaUa9fEhbEiYfv8+0LLQSAU WyuCl3dtCM7Q1H06sJKFLu4kQRZ/Y47kSebd9HkxlzTZulFD+CLsAsNCIXUjR9XBcYoq vAjVihhiKpZkb7JmMrvXJU8VsCcP/wdWrPGX2jcF579w/oT21zk0i/88R0NCw98CImJE bH5SoxTMqkZSAhunBavmskSB3JipLrgRlaVPq5Cljf8uZ8vpylLj5IuwB2eHyvLn2/Ge 3D2w== X-Gm-Message-State: AOJu0YwL6425ykf6F3vwLwsvboW9cns7Y2nkbf129REq7Hwd4OhBaFZ1 jZ8Z49Yx6xmSY61xXGsQyWDyEdMQCjGpQ/ZjvaKN24Rkd3rKh8D5eSS7kw== X-Google-Smtp-Source: AGHT+IH74/QvF7XJjs74wjA7cOYVNnpHDb/6j4D3S2NdAL/6W9Yg978pMY0RU9tcLXKyHXq3ORJizQ== X-Received: by 2002:a9d:73ca:0:b0:6f0:6958:d0fe with SMTP id 46e09a7af769-6f0e92a92ffmr4213652a34.29.1715388728608; Fri, 10 May 2024 17:52:08 -0700 (PDT) Received: from [10.0.0.143] (99-43-252-18.lightspeed.sntcca.sbcglobal.net. [99.43.252.18]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6340c99bc09sm3205886a12.39.2024.05.10.17.52.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 May 2024 17:52:08 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------iStfJfF1YC49AU7DXseyiOLx" Message-ID: <8d1d947e-75af-4a9a-b726-dabe9858b2b0@gmail.com> Date: Fri, 10 May 2024 17:52:07 -0700 MIME-Version: 1.0 User-Agent: Betterbird (Linux) To: Zsh Users Content-Language: en-US From: Kannan Varadhan Subject: colorizing printfs X-Seq: 29923 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: This is a multi-part message in MIME format. --------------iStfJfF1YC49AU7DXseyiOLx Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit My version: ~⦒zsh --version           ▮▮▮▮▮▮▯▯▯▯ 17:26:13 zsh 5.9 (x86_64-pc-linux-gnu) I am trying out variations suggested here: https://unix.stackexchange.com/questions/408867/how-to-colorize-some-of-the-output-of-a-shell-script and am confused. One of the last (I expect ideal) suggestions is: % text=xyz % |printf '%s\n' "${(%):-%F{green}}$text${(%):-%f}"| | | |When I try it:| |~⦒printf '%s\n' "${(%):-%F{blue}}test${(%):-%f}" ▮▮▮▮▮▯▯▯▯▯ 17:33:45 }test| |I have a trailing `}' which I think I should not see.| |If I split this up,| |~⦒printf '%s.%s.%s\n' "${(%):-%F{blue}}" "test" "${(%):-%f}"               ▮▮▮▮▮▯▯▯▯▯ 17:35:41 }.test. ~⦒printf '%s.%s.%s\n' "${(%):-%F{blue}}${(%):-%B}" "test" "${(%):-%b}${(%):-%f}" }*.test.*| || |same result.  The extra parenthesis, but the %B/%b print codes worked as expected. | |If my reading of the zsh man pages is correct, this one should be identical to the last one above, | |~⦒printf '%s.%s.%s\n' "${(%):-%F{blue}%B}" "test" "${(%):-%b}${(%):-%f}" %B}.test. | |Instead I get the above `%B}' in the output.| | | |What would I be missing?| | | |Curious,| | | |Kannan | --------------iStfJfF1YC49AU7DXseyiOLx Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable colorizing printfs


My version:

~=E2=A6=92zsh --version=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =E2=96=AE=E2=96=AE=E2=96=AE=E2= =96=AE=E2=96=AE=E2=96=AE=E2=96=AF=E2=96=AF=E2=96=AF=E2=96=AF 17:26:13
zsh 5.9 (x86_64-pc-linux-gnu)

I am trying out variations suggested here:=C2=A0 h= ttps://unix.stackexchange.com/questions/408867/how-to-colorize-some-of-th= e-output-of-a-shell-script

and am confused.


One of the last (I expect ideal) suggestions is:

% text=3Dxyz

%=C2=A0printf '%s\n' "${(%):-%F{green}}$text${(%):-%f}"


When I try it:

~=E2=A6=92printf '%s\n' "${(%):-%F{blue}}test${(%):-%f}"=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =E2=96=AE=E2=96=AE=E2=96=AE=E2=96=AE=E2=96=AE=E2=96=AF=E2=96= =AF=E2=96=AF=E2=96=AF=E2=96=AF 17:33:45
}test

I have a trailing `}' which I think I should not see.

If I split this up,

~=E2=A6=92printf '%s.%s.%s\n' "${(%):-%F{blue}}" "test" "${(%):-%f}"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =E2=96=AE=E2=96=AE=E2=96=AE=E2=96=AE= =E2=96=AE=E2=96=AF=E2=96=AF=E2=96=AF=E2=96=AF=E2=96=AF 17:35:41
}.test.
~=E2=A6=92printf '%s.%s.%s\n' "${(%):-%F{blue}}${(%):-%B}" = "test" "${(%):-%b}${(%):-%f}"
}.test.

same result.=C2=A0 The extra parenthesis, but the %B/%b print code= s worked as expected.

If my reading of the zsh man pages is correct, this one should be identical to the last one above,=C2=A0

~=E2=A6=92printf '%s.%s.%s\n' "${(%):-%F{blue}%B}" "test" "${(%):-%b}${(%):-%f}"
%B}.test.

Instead I get the above `%B}' in the output.

=


What would I be missing?


Curious,


Kannan

--------------iStfJfF1YC49AU7DXseyiOLx--