[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash Reference Mamual
From: |
Lawrence Velázquez |
Subject: |
Re: Bash Reference Mamual |
Date: |
Sat, 17 Oct 2020 19:45:07 -0400 |
> On Oct 17, 2020, at 7:35 PM, Eduardo Bustamante <dualbus@gmail.com> wrote:
>
> <(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.
If you want terms you can look up, $(cat file) and $(< file) are
*command substitutions*, while <(cat file) is a *process substitution*.
$ printf 'FILE CONTENTS' >tmp
$ printf '|%s|\n' "$(cat tmp)"
|FILE CONTENTS|
$ printf '|%s|\n' "$(< tmp)"
|FILE CONTENTS|
$ printf '|%s|\n' "<(cat tmp)"
|<(cat tmp)|
$ printf '|%s|\n' <(cat tmp)
|/dev/fd/63|
--
vq