Re: more splitting

Bart Schaefer <[email protected]> Tue, 14 Apr 2026 23:38:04 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAH+w=7ZwT93FhK8ZrBWHHJDdSZ-5M5L_9+Qmvb_x-AZ6mRrUbQ@mail.gmail.com>
On Tue, Apr 14, 2026 at 7:02 PM Bart Schaefer <[email protected]> wrote:
>
> More later about $(<&0) ...

This is a pretty clever bit of code.  It's using $(<filename) syntax,
which tells zsh to open the named file directly instead of doing the
usual thing of creating a subshell for $(...).  However, there's no
filename!  Instead it tricks the parser into acting like there's a
filename by using the <& redirection syntax, which opens a file
descriptor instead of a name.  The chosen descriptor is 0 (zero) which
is standard input:  <&0 is normally a no-op.  Here, though, it turns
standard input into a substitution.