[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash Reference Mamual
From: |
Eduardo Bustamante |
Subject: |
Re: Bash Reference Mamual |
Date: |
Sat, 17 Oct 2020 16:35:24 -0700 |
On Sat, Oct 17, 2020 at 3:48 PM Craig H Maynard <chmaynard@me.com> wrote:
> Hi,
>
> In section 3.5.4 "Command Substitution", the following sentence may have a
> typo:
>
> > The command substitution $(cat file) can be replaced by the equivalent
> but faster $(< file).
>
>
> My proposed change:
>
> > The command substitution $(cat file) can be replaced by the equivalent
> but faster <(cat file).
>
>
> If the manual is correct and I misunderstood something, please let me know.
>
Hi Craig,
<(cat file) and $(cat file) are not equivalent constructs. The former will
expand to a file name (e.g. "/dev/fd/63"), whereas the latter will expand
to the contents of the file.
In the case of $(cat file) and $(< file), they are equivalent, except
that in the second case there's no external command ("cat"), and instead
Bash reads the file and does the expansion itself.