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.