[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: funsub questions
From: |
Greg Wooledge |
Subject: |
Re: funsub questions |
Date: |
Wed, 13 Dec 2023 21:17:05 -0500 |
On Wed, Dec 13, 2023 at 08:50:48PM -0500, Zachary Santer wrote:
> Would there be a purpose in implementing ${< *file*; } to be the equivalent
> of $(< *file* )? Does $(< *file* ) itself actually fork a subshell?
$(< file) does indeed fork. The only difference between $(< file) and
$(cat file) is the latter also does an exec (but it's portable).
If you'd like to read the contents of a file into a variable, the
"read" and "readarray" (aka "mapfile") builtins are usually better
choices anyway. $(< file) would only be useful if you want the entire
content in a single string variable, which is a questionable idea in
most programs.
- funsub questions, Zachary Santer, 2023/12/13
- Re: funsub questions,
Greg Wooledge <=
Re: funsub questions, Andreas Schwab, 2023/12/14
Re: funsub questions, Kerin Millar, 2023/12/13