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.2 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, 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 5AB1D265B6 for ; Tue, 7 May 2024 00:34:30 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715034870; b=chcfRmfUYBpduH6uYAA9AxmG/27dzLhCoGNK9/4ydrH64Bo1d+QB3bDSGXoU7gPvaGtsiEUZw4 62YWY7IqScctP2zBt08nAl14Gs2LTEXFYIiCx/lskKYn+37g8634PdZSCGKH5GBv/FB5y/w0nM 8xHNLEETRQSVe2wE9qiMZkgYLOLvSGkC7zAxuJ8rcfC1ZPd57ri90Gd54zE91E+A8H2XNeEaqy FnlxO+MuvJOncrBqUhqbbMMpnHl5vogEht6qM1pRiYpKBQHcgcAy2d9b9SUTeEdcofPCsJq2o+ c3XMnlBTwxtsxEC/hnhXnbBnrASkKIZbem9wgK45wCRVdg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f177.google.com) smtp.remote-ip=209.85.208.177; 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=1715034870; bh=yDJcXvVm79GeLPKQjVBhUyMIieBx2IMhp/jCZib8J70=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=DFvJYuvdQj2WJqcuQodakDbreQwEodskH4vUkoFjy0r2epobdiNB4t3daQeVNy+MtBqPuEyxbT XqZ23Q29jfEYjZ3QXsZL+WtupZaASeyPowIncSWc8wGvh0rN/RUPe8obLfUmhy+VQLUyys18Oq J35uOOsJ0PW3xO7X4eyNJ+K+Zyi05rWoEJgD2aYZm9q0E7IW6ORJK37vqruZzPpBEs8q57/7TV sAC10imZEq166hj9ZbdsT0m5xOIqrATALkbhv604i62qn+jkTeW5mfHAA9wt7SJ2GX2llbSdHB Jo+B+7AC+92VckZy1fqN9GfrJVbQMeV0UCYapJMmdgnyAQ==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=sO3klPH0w9eWzbVQKJ/Z/8cEhK4CaLxmmVbaPKazyp8=; b=LDa1vs3dHHrwEpn0WB79/Ua/rH 15wdysY8ZDedC/dPz0qDcKh4nHV07n9uJGB3fd4I+A6Ox0mznmaulL09B9q94mlplaRk8cYSjcpfU 1kfZFQ8RKGDrVdZtQXLu8BOOrIyfG1hk+Ser+4IavxPoETvsjIJTtsI9zdHtjStCUdCeyDJ4GCbCP OBTxYBs3cQ+RPDziyko4JCRl4Z9TfMVNV17mQZF+o+8UQJzipzRstdObXylVvTNTmcpt6J8rg0kO6 GwegfEQ56spoOFKxGa4VQLsAWmVNjPCTZhXrGCwEYC0JogKuDT2KZ6Ll9zbk5Lv4HnC4ll+H2mQoB v0fYgb9A==; Received: by zero.zsh.org with local id 1s46uk-000DWI-Fo; Mon, 06 May 2024 22:34:30 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f177.google.com) smtp.remote-ip=209.85.208.177; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-lj1-f177.google.com ([209.85.208.177]:58550) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s46uC-000CmD-Az; Mon, 06 May 2024 22:33:56 +0000 Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2e3e18c240fso3440401fa.0 for ; Mon, 06 May 2024 15:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715034835; x=1715639635; darn=zsh.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sO3klPH0w9eWzbVQKJ/Z/8cEhK4CaLxmmVbaPKazyp8=; b=STIUU32CZyrnayqCG0SENDvKWRi3sKpKZ8AS/MqBeaDpPjII5KAA/ceOJ9fYaDODpF TQnooSiT116iXJJWPaXVbdwVx8DsjgX2xPPW0SGCxnw9IR4FzQjDSljaG85GTMul0Rmj Wp/XAXWvX/BN6ebgNQv3UWrHHK7LkXsJ+c7IiBKcqEdc92A08DsxYeynGvUdr2ZYeRlD mXA6Ib5IqiBnzBtF4BLjw8UbMQPwD9HaiFOR0z0IWYZn0xNB74cpGy+TOT0jZoaVpXIi uVX8Ijho7xR+laRLBUGG3jrRuOv3W1CeNcIGdfowYDRzEw1dwJvFojw1n8ezCDoE1Ng4 rWPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715034835; x=1715639635; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sO3klPH0w9eWzbVQKJ/Z/8cEhK4CaLxmmVbaPKazyp8=; b=Gs130UtTG4Z/qLNEZb8dEDJUrCyTdf6TPVoVhj65+JzSxch51rcRZu+sZAePkCc+iE TS2PcRo7wvRie8rcswfy2xT7pBSpJcaix4etY3UAVI4AiCAilMgQUJwB7TOwZa0Qcvou H9y/HFI6hqUDlxlliznvLd8K0o+lHNiTJSzT2po50RWp+U/Q9fkLZjX8jVcToGMMy+EE 0k0eqgqwKWeVh5Z+At8/pcId63ysfZq79sAyXcWE/33huciwHBFn9ctDv9yxF85/ITRL R1T7NIkK2nN1zOgdtMYhV0HZsW7nbNdqdXl1AqWeCbiKdnmWkMVC7wpTW8cZYcKYYaQJ uEeQ== X-Gm-Message-State: AOJu0YyM1BhrD/BJOAYxgVxsAERJv5F3MqW+ZwYVgkyfMYiLubOWu5Yu BjDapBwk6HiuqIjigw1dTaj5YB6S5lufjdgdNLSKQReLEaQKQJdHZMlr5uwh0u9YF3whr7G+Ye0 +pyOzKl4k8M/2k15/RQASv5nDHyhNlzqTX1o= X-Google-Smtp-Source: AGHT+IErGkt8K6XaboXEmReb3O6Mj6c4o4qX8MpOG/kZ3jGrDHnwoDcpcVRZQY7vosKyVnyrslVL4UBofZ9fVxX151Y= X-Received: by 2002:a2e:83d0:0:b0:2e2:9416:a63f with SMTP id s16-20020a2e83d0000000b002e29416a63fmr6007184ljh.53.1715034835010; Mon, 06 May 2024 15:33:55 -0700 (PDT) MIME-Version: 1.0 References: <8809e9e7-2389-4bb7-ba67-95222d302594@eastlink.ca> In-Reply-To: <8809e9e7-2389-4bb7-ba67-95222d302594@eastlink.ca> From: "Mark J. Reed" Date: Mon, 6 May 2024 18:33:43 -0400 Message-ID: Subject: Re: create variable with calculated number of spaces. To: Ray Andrews Cc: Zsh Users Content-Type: multipart/alternative; boundary="0000000000001e4e5f0617d0aa3d" X-Seq: 29913 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: --0000000000001e4e5f0617d0aa3d Content-Type: text/plain; charset="UTF-8" printf "%${spacer}s" "" ? Mark J. Reed On Mon, May 6, 2024 at 18:04 Ray Andrews wrote: > So I want to adjust the length of string1. I do this by inserting a > spacer in string1 who's length is calculated from the length of string2: > > local diff spacer > (( diff = $#string2 - 76 )) > for (( dd=1; dd ... # spacer will be incorporated into string1, not shown. > > It works fine, but I'll bet there's a less laborious way -- some way of > creating 'spacer' with 'diff' number of spaces without the for loop. I > could make 'spacer' too long and then cut it at an index [diff], but I > doubt that's as simple as it could be. I know it's there, I just can't > quite remember. > > > --0000000000001e4e5f0617d0aa3d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
printf "%${spacer}s" "" ?

Mark J. Reed <markjreed@gmail.com>
<= /div>


On Mon, May 6, 2024 at 18:04 Ray Andrews <rayandrews@eastlink.ca> wrote:
=20 =20 =20
So I want to adjust the length of string1. I do this=C2=A0 by inserting a spacer in string1 who's length is calculated from the length of string2:

=C2=A0=C2=A0=C2=A0 local diff spacer
=C2=A0=C2=A0 =C2=A0(( diff =3D $#string2 - 76 ))
=C2=A0=C2=A0 =C2=A0for (( dd=3D1; dd<diff; dd++ )); do spacer+=3D&= #39; '; done
=C2=A0=C2=A0=C2=A0 ... # spacer will be incorporated into string1, no= t shown.

It works fine, but I'll bet there's a less laborious way -- s= ome way of creating 'spacer' with=C2=A0 'diff' number of = spaces without the for loop.=C2=A0 I could make 'spacer' too long and then cut i= t at an index [diff], but I doubt that's as simple as it could be.=C2=A0 = I know it's there, I just can't quite remember.=C2=A0


--0000000000001e4e5f0617d0aa3d--