zsh-users
 help / color / mirror / code / Atom feed
From: "Mark J. Reed" <markjreed@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: create variable with calculated number of spaces.
Date: Mon, 6 May 2024 19:28:00 -0400	[thread overview]
Message-ID: <CAA=-s3wGmDa0BMpn0SJOJh0LV6vmZzV=izZBuPguX5XnYLescA@mail.gmail.com> (raw)
In-Reply-To: <9022e6cd-74a0-4438-a858-c0cf2f747d8e@eastlink.ca>

[-- Attachment #1: Type: text/plain, Size: 929 bytes --]

The printf command is built into zsh. I'm not sure what makes it "fancy" or
non-native.

(Of the three printing commands it's also the one that works the same
across bash, ksh, and zsh, but that's not a concern if you're writing a
specifically zsh script.)

Mark J. Reed <markjreed@gmail.com>


On Mon, May 6, 2024 at 19:04 Ray Andrews <rayandrews@eastlink.ca> wrote:

>
>
> On 2024-05-06 15:38, Mark J. Reed wrote:
> > or, more efficiently:
> >
> >     printf -v spacer "%${diff}s" ''
> Nice and compact.  One thing tho, I'm not sure this is the correct way
> to think, but I have an instinct to stay away from 'fancy' commands like
> printf and to rely on native zsh code where possible.  Legit?  Or false
> frugality?  What I half-remember is some loop that has an iteration
> counter.  Mind, there was one of Roman's speed tests where he used an
> external command and had a huge performance improvement, so thereyago.
>
>
>

[-- Attachment #2: Type: text/html, Size: 1650 bytes --]

  reply	other threads:[~2024-05-06 23:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 22:03 Ray Andrews
2024-05-06 22:33 ` Mark J. Reed
2024-05-06 22:35   ` Mark J. Reed
2024-05-06 22:38     ` Mark J. Reed
2024-05-06 23:02       ` Ray Andrews
2024-05-06 23:28         ` Mark J. Reed [this message]
2024-05-06 23:41           ` Ray Andrews
2024-05-06 23:57       ` Lawrence Velázquez
2024-05-07  5:14         ` Ray Andrews
2024-05-07  5:52           ` Roman Perepelitsa
2024-05-07 14:56             ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA=-s3wGmDa0BMpn0SJOJh0LV6vmZzV=izZBuPguX5XnYLescA@mail.gmail.com' \
    --to=markjreed@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).