Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Capturing STDOUT without subshells or file I/O



On 17 Sep 2018, at 15:13, Ben Klein <robobenklein@xxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author