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 2F9342213C for ; Tue, 7 May 2024 00:36:44 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1715035004; b=ZCkcS6mwSxr7KPjhic7p4DjEgpdCYvl0YXI1qxj71/bmTqFvKxmTchdGeupCnL5pAQP5XzP8CS K4A70Dujp3isP4kOnEs0ysstiYUT7wJiizh4YVqAHlG1+vx3czoLXlt97z0Au+2kpZYeCvmhN2 fzvD04ptXLOHm87nHN76V3NxNufXg6ZbhFy/c7NnCjBOleiez1ZBwV3nrfKKe7R6QQl++W4Aih FhZ6CxcvQXVNNh49hoqWhnap3LqddAsAdvg6t8BoDV2WFsepHHhN+428i8mTIKJuHxky6vxq7+ K/BOFmIwsJ/FYe6ratvnLbGGzuU1l4GBpJV5bREJr0qy4g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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=1715035004; bh=dich3qgbx5yY4Bjf7F0Sq0XljdJmE9NdIdXD/rHBsvs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=PdJFGvh4FqYPo7rQY7d+39Wfm4kfKkZTDr746BE/DdDUJWUQ1AucEXsSpYHKJOPnF7XjFvNSv2 yNcHdAlfOX2aBAmLiFZAqpv2+Nf9Fhjow7XGnxucnCSwvikX9gXX6H31fOb5ZlBFrWr6hw6mRr gQuAp2eVXOrmbvwCok4uwZ2K98sArBtShzYKlWftVbO/1ng7Sdqgr8i9gTrjR6lV3tdeTnxXxz CgEk31wiQn7dNf/lgbcfNcxZIwh31J19+FtrggG5puksSzUkR0DMTbMbHWLaIn9PF+kt4s5FyK 8ebtjFxx484alMr8a/Q6LaA+J5Io1WlDwVAW2oWat3kI+A==; 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:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=bwOk+E+qSrQnJFynK0Dq0A+0+X0EGJv5GNvhGTG8muw=; b=g+CccpWiV7DxuKw5VOuba1/gUM ruSBmzwxhiWLP6lK74YukOOY5WxdqGkGrA5xr5MCmPmuyFUIrfu5jOPXuzo/ZmDCVLJQLuXb/X2da yG0hNhlX09XpWxOXW0ArkP0So66NuKRf3rZpMhQ52FyOfPCkKQLT/Pk9cSgZk0KGudhlvRYta6b+M hMcXMA4RLLb3POmU8yxrKeuM7qH5f8GGo5QV3Oi96Ps2zbGws7QY6QZVKqRWrAfxzfmy5/I3QwJyd /JVNZt/qle+c2uz6QUgnrHrhOuDoMuApZWlXbK8412S30MvMW9I9lYXrzmxHEGgLw3jKEqs78AQxr R+unCQ2w==; Received: by zero.zsh.org with local id 1s46wt-000Eii-W5; Mon, 06 May 2024 22:36:44 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lj1-f170.google.com) smtp.remote-ip=209.85.208.170; 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-f170.google.com ([209.85.208.170]:49434) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1s46wM-000Dys-PI; Mon, 06 May 2024 22:36:11 +0000 Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2db17e8767cso30797961fa.3 for ; Mon, 06 May 2024 15:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715034969; x=1715639769; darn=zsh.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=bwOk+E+qSrQnJFynK0Dq0A+0+X0EGJv5GNvhGTG8muw=; b=f3OQCDLwN2xjiC+iaASRSDWBlWQ0RfZvpisvIHkZb5b0UEn8J/9XAEIEzi8D2TdEPD 1ALpuy2f6BJV0VPnjEkxKu8Bf+DA+ZI1+m9/61TkynACS224+bCCxojE039Dg/Vn50vn Oi03V5A17Fdxl4T6+umCDuycoCUBfIATuxpLkmwMtFf0ReLDRz/unOwy7ut7+jdWN5vQ 7RqNaabLeXIF4XnQm/6J9vkq9RQONRzivhGkPPo1fmcYHkIvpjrX5KAaGpSg1Fxun421 WRh+fJpYk+RW+7f/csuLg6jKzwimhPE9kSAUWn6F7Gqdo9OZMGN5f27TKHIsQtE1efDG tJHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715034969; x=1715639769; h=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=bwOk+E+qSrQnJFynK0Dq0A+0+X0EGJv5GNvhGTG8muw=; b=IuC3WARLU19PP25M2P7S3YU+k9kE8mQFkDVQOeEDa8aARM0EcUIrN77m5HnqUX8Yf4 RQghybrBji/tmCbH6djZsPUi/q3DBqNpXWkS30OrYBkY4iM8vNtCWuj/fNHYwZpjZW0/ 5wVkUz8zdFlqlO+36S4ZHRJ9JA3kK/aXgVLMEgLLzLNqbhUsSzHkXxB7hg1G+cUZPoo3 hFHxGiRs115pTKvN/1fzlGRkTqm5cpapho/E4Tb4GQ0NRD1ImL7NxUchJMqV2j1vAp7F H1xjKpM6DnmNxDjfj99mVmuOlu8Y9uobL96vxFSIZrVHNxP+UAqxdtan+ujmUE7Z2qEa AaKA== X-Gm-Message-State: AOJu0Yz1D6on0miQKhl+YFhGSRnSRd3u5MApjmgHoMMu0mv8dxPG1nZ+ SN4TPDEOkbTnN7gn++LmX8HrKjIOyXL2CfcmvdLkcwmkwG1zVN8sJghQHQIsWNl+aj+KHy3r3kV NoS2uSne3eq7ai74lHVNPsvataysFqA== X-Google-Smtp-Source: AGHT+IF2MDuXSWXkjlNEEJpvQTLL9KKgHbMvMNX1+IMWqksnakzWErSXIYyVHjP5bbihf1nli+ADu9ym9DXmYzjOPQg= X-Received: by 2002:a2e:602:0:b0:2e3:cba4:234 with SMTP id 2-20020a2e0602000000b002e3cba40234mr902193ljg.10.1715034969064; Mon, 06 May 2024 15:36:09 -0700 (PDT) MIME-Version: 1.0 References: <8809e9e7-2389-4bb7-ba67-95222d302594@eastlink.ca> In-Reply-To: From: "Mark J. Reed" Date: Mon, 6 May 2024 18:35:57 -0400 Message-ID: Subject: Re: create variable with calculated number of spaces. To: Zsh Users Content-Type: multipart/alternative; boundary="0000000000001bcdd90617d0b2c6" X-Seq: 29914 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: --0000000000001bcdd90617d0b2c6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Well, mixed up your var names. This is what I meant: spacer=3D$(printf "%${diff}s" '') On Mon, May 6, 2024 at 6:33=E2=80=AFPM Mark J. Reed w= rote: > 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 =3D $#string2 - 76 )) >> for (( dd=3D1; 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. >> >> >> --=20 Mark J. Reed --0000000000001bcdd90617d0b2c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Well, mixed up your var names. This is what I meant:
<= br>
=C2=A0 =C2=A0 spacer=3D$(printf &quo= t;%${diff}s" '')


On Mon, May 6, 202= 4 at 6:33=E2=80=AFPM Mark J. Reed <markjreed@gmail.com> wrote:
printf "%${spacer}s" "= ;" ?

Mark J. Reed <markjreed@gmail.com>

=

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




--
Ma= rk J. Reed <mar= kjreed@gmail.com>
--0000000000001bcdd90617d0b2c6--