Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Capturing STDOUT without subshells or file I/O
On Mon, Sep 17, 2018 at 2:19 PM, dana <dana@xxxxxxx> wrote:
>
> Mikael once showed me this trick:
>
> print -zf '%.2f' 3.4
> read -rz var
> echo $var # 3.40
That's pretty close to exactly what "printf -v" does underneath. It
just requires that the buffer stack be present, so it means the zle
module has to have been loaded -- but that happens even in
non-interactive shells unless you do something to prevent it, so it
should work almost all the time.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author