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_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 EE1F6222F4 for ; Tue, 7 May 2024 16:57:02 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715093822; b=PB/JPHYhpx51idpS2hs1osjxc708bZilOmQQD45E7adMl30FatKJFQwod7Ryf7csq287+/Kk8V qGuCDqOfeKr/In3uP7rQ5GnVRnh80FLoiayd2klUkI9j9gfRiMCznjOZ5AkD5UyEuK1NpngRoW CEIqwUVaz7hNxjCIcEH1KfasT2nw1VDAOwUQTzTb4jaSjcDHOlZQzBagA9wA3itQMNLV94J50k vbnsZrZhc8jlY2oq5qTph4jhBAheCOx5l9eLuAe57RwGDevIAOId9Y8bXv37axoOb4G66y9mSf VLY8qOM7A9CDVn8nO0F4m5zqs1lCmWdGCeyYd2vgn96Hfw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1715093822; bh=hBDlKc5AinY/KjG+ZNiqRiHo0KCI1CGnoWfGtQpv8yU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=EJm5cildzNnFEeAo9YpTMGiI82iCl1ENYx+JEppjSQwHVLjbwkjuD8HvEng2l76tWzNcbyAtsF 0XPo9zrHpkYqOc5L0YLRVQXQ/EytwVyo5tPi5gLJTjlyJ4v9C9KmnISAudEbic8yu/EBFLEf41 QOPM5v+uuWnKS4ztai9vn+lmrDS3RVLtEuATpp+KXdy9G4vywqHBEn/Gnrbo0LZu8r7edpudGx PzEuK/BbgXaq0xCOm2rGEW0wkudAS0DkzLw/4STczMo+T5AfT9cZVuwyvGbNDUHqV697ddUp9K vQJ5S7nctwlGS5FOYegVddQKnmnoXOeRCAnriHqi9kjc2w==; 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:In-reply-to:From:References:To: Subject: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; bh=fcIdz4J0ZxAPzOnCg0kdGXIhRtiTQhvZSAStnWz+wKo=; b=Vqlofz/hseCNKzkUBORbOtvgTe YrgwIwoVmvRCNmp0BFZpHWKjlw4nrNXc05SimNO57XQQcUvjTabIR5ag/ahGovrDaGUyWrqK/1km7 2e1Z455bIdxh6UwjdWk5gA1vrdSouCV8psiI00RkXAkkNsDwhfCaFiZXG7p0CChknGBOGyEuA2obw JgWD44wytwzCZjQX7f5fARnrFsQdomDRxvEClethMRu/KOgM4by13m+CxV+bXzpW/Qn9sJezgG91T Ih5n79Nm08hx2oFmgPss7wPxd+kjDKw2p/3uVYbcoodYsdCYVv2nTkGYhqYZI5Ahgc0PqXqrZKsBA 63Mq0KnQ==; Received: by zero.zsh.org with local id 1s4MFY-000OuT-Uv; Tue, 07 May 2024 14:57:00 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:40775) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s4MEm-000ODq-S9; Tue, 07 May 2024 14:56:14 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta04.eastlink.ca ([24.224.136.10]) with ESMTPS id <0SD415MYGES0EFI0@mta04.eastlink.ca> for zsh-users@zsh.org; Tue, 07 May 2024 11:56:11 -0300 (ADT) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id 4MEkst7YL98ni4MEkspoDe (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Tue, 07 May 2024 11:56:11 -0300 X-Authority-Analysis: v=2.4 cv=C75KyhP+ c=1 sm=1 tr=0 ts=663a410b a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=yNsfhar6UCdIfkRmOBEA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=nZNHQ80a3P7LdwUig30A:9 a=jWadbyupUjPiQXNJ:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddvkedgkedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderredtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpefhteethfevgeeuvdelgefgvdevudefueduffdvgfelvddvgfdtieegueeuleeifeenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduudgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------xgDey2FJTEbktX8VIaiERRgw" Message-id: <255c5dbd-c8d3-4cf7-bcec-6a3c1cfc8e71@eastlink.ca> Date: Tue, 7 May 2024 07:56:10 -0700 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: create variable with calculated number of spaces. To: zsh-users@zsh.org References: <8809e9e7-2389-4bb7-ba67-95222d302594@eastlink.ca> <2c187631-8284-4f35-a1a2-f982e42dd704@eastlink.ca> Content-language: en-US From: Ray Andrews In-reply-to: X-Seq: 29922 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. --------------xgDey2FJTEbktX8VIaiERRgw Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-05-06 22:52, Roman Perepelitsa wrote: > You don't need to "cobble together complicated variables" here. Just > printf straight away to stdout. I know, I  mean in other situations where the variable really is complicated.  I've seen 'printf  -v' offered previously to do some pretty fancy stuff. > % n=10 > % y=${(r:n:: :)} # n spaces > % x='hello' > % z=${(r:n:: :)x} # right-justified x Jim Murphy offered:         spacer=${(l:diff:::: :)} ... very much in the same school of thought.  Feels more 'direct', if that means anything.  Mark suggests I shouldn't worry so much about 'economy' -- I tend to not want to use an elephant's worth of functionality ( printf ) where a mouses worth will do.  But maybe that's not a valid way to think cuz I can't really anticipate how the shell will actually get the work done. --------------xgDey2FJTEbktX8VIaiERRgw Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 2024-05-06 22:52, Roman Perepelitsa wrote:
You don't need to "cobble together complicated variables" here. Just
printf straight away to stdout.
I know, I  mean in other situations where the variable really is complicated.  I've seen 'printf  -v' offered previously to do some pretty fancy stuff. 

    % n=10
    % y=${(r:n:: :)}  # n spaces
    % x='hello'
    % z=${(r:n:: :)x}  # right-justified x
Jim Murphy offered:

        spacer=${(l:diff:::: :)}

... very much in the same school of thought.  Feels more 'direct', if that means anything.  Mark suggests I shouldn't worry so much about 'economy' -- I tend to not want to use an elephant's worth of functionality ( printf ) where a mouses worth will do.  But maybe that's not a valid way to think cuz I can't really anticipate how the shell will actually get the work done. 




--------------xgDey2FJTEbktX8VIaiERRgw--