zsh-users
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Ben Klein <robobenklein@gmail.com>
Cc: zsh-users@zsh.org, Daniel Shahaf <d.s@daniel.shahaf.name>,
	Joey Pabalinas <joeypabalinas@gmail.com>
Subject: Re: Capturing STDOUT without subshells or file I/O
Date: Mon, 17 Sep 2018 16:19:48 -0500	[thread overview]
Message-ID: <61C90346-A07B-49A7-8062-DF5AA614F133@dana.is> (raw)
In-Reply-To: <cd8bc7e0-7ae1-8c94-8dea-9b529b2a8fb2@gmail.com>

On 17 Sep 2018, at 15:13, Ben Klein <robobenklein@gmail.com> wrote:
>So I guess the question is up again, how should I capture the `printf` output
>without the `-v` option, no subshells, and no file I/O? Is there a different
>method for ZSH v5.1?

Mikael once showed me this trick:

  print -zf '%.2f' 3.4
  read -rz var
  echo $var # 3.40

Not sure if there are any situations where it would break.

dana


  parent reply	other threads:[~2018-09-17 21:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-02 20:57 Ben Klein
2018-09-03  0:40 ` Joey Pabalinas
2018-09-03 14:02 ` Daniel Shahaf
2018-09-03 18:43   ` Joey Pabalinas
2018-09-17 20:13     ` Ben Klein
2018-09-17 20:46       ` Daniel Shahaf
2018-09-17 21:01         ` Mikael Magnusson
2018-09-17 21:20           ` Bart Schaefer
2018-09-17 21:19       ` dana [this message]
2018-09-17 21:33         ` Bart Schaefer
2018-09-18  5:12 ` Sebastian Gniazdowski
2018-09-21  6:58   ` Oliver Kiddle

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=61C90346-A07B-49A7-8062-DF5AA614F133@dana.is \
    --to=dana@dana.is \
    --cc=d.s@daniel.shahaf.name \
    --cc=joeypabalinas@gmail.com \
    --cc=robobenklein@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).