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

Re: more splitting



On Tue, Apr 14, 2026 at 7:02 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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.




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