Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Capturing STDOUT without subshells or file I/O
- X-seq: zsh-users 23654
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: robobenklein@xxxxxxxxx
- Subject: Re: Capturing STDOUT without subshells or file I/O
- Date: Tue, 18 Sep 2018 07:12:11 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7ozzzgSwmGNMAiSELqYkq0jKAdW0M8TKEoJ7IMoHwMY=; b=XZvidNTY6eBXqlpltb+YHI4jqGkndBZNCeghrXYbEwDHmuJPODvTr9g6ui08LZ8F1u G70HxNOpyIVyuCWsnKlnzGH2J/RaJ8paw47emcSCVBgEqH3BDv6D0WTUZPoPDwDwNNQ2 cLvE76kIWydC6tsrMGqY5ae+/fKKBIO15q/yFCSOHjbuwchR+SaJilC7zM4EoQBA9B7z 8gNY261WCNWRTlUyeyp+6Ep5DaUI43HDm1BWeuo3dGzgkZszaTokWfdwmouN1bLaifzi 29k1pBX7fXWESg+KPbn9EP67zA5KPse4gLeYvScb/ATlV1nwPNj3DlMeB/gS95uF8JPH A3gg==
- In-reply-to: <04a12c6a-c926-b088-f386-8a2bdb81dad2@gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <04a12c6a-c926-b088-f386-8a2bdb81dad2@gmail.com>
On Sun, 2 Sep 2018 at 22:59, Ben Klein <robobenklein@xxxxxxxxx> wrote:
>
> Hello Zshellers,
>
> I have an interesting predicament, I with to capture the STDOUT (builtin printf) of a ZSH function to a variable, in which the function should be running in the current shell context.
mksh can do this with:
${ foo;}
foo runs in current shell and the ${ ... } is substituted with its
output. One more cool thing mksh has - ${|foo;} which is replaced by
the value of REPLY after running foo in current shell. I think that
each time a serious, optimized coding occurs (like when creating an
advanced theme), those will be very handy.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author