On 6/2/20 9:44 PM, Dale R. Worley wrote: > Naively, I expect that > > FOO="$( command2 )" > command1 $FOO > > has the same effect as > > command1 $( command2 ) > > and > > FOO="$( command2 )" > command1 "$FOO" > > has the same effect as > > command1 "$( command2 )" > > Has anyone pushed the boundaries of this and can tell me whether there > are gotchas?
What boundaries were you expecting? If this is related to the thread about the value of $? after command substitution in variable assignment vs. command arguments... that's already a gotcha according to many people. Despite being both documented and logical. Aside for that, obviously in one case you don't have a "FOO" variable in the shell environment, which does seem like a fairly major difference as it's a very common pattern for people to reuse the results of command substitution multiple times. Perhaps you meant to say "executes the same command process" instead of "has the same effect"? -- Eli Schwartz Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature