Quoting is useless when assigning variable from ouptut of command or another variable:
$ foo=1 2 3 4 bash: 2: command not found Ok. But $ foo=$(seq 1 3) $ declare -p foo declare -- foo="1 2 3" $ foo="$(seq 1 3)" $ declare -p foo declare -- foo="1 2 3" No difference with or without double-quote. $ bar=$foo $ declare -p bar declare -- bar="1 2 3" $ bar="$foo" $ declare -p bar declare -- bar="1 2 3" Again, double-quoting is useless. But for commands: $ printf "<%s>\n" $foo <1> <2> <3> $ printf "<%s>\n" "$foo" <1 2 3> Same than $ printf "<%s>\n" $(seq 1 3) <1> <2> <3> $ printf "<%s>\n" "$(seq 1 3)" <1 2 3> Unfortunely, I don't retrieve this behaviour in man page. On Tue, Jun 02, 2020 at 09:44:45PM -0400, 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? > > Dale > -- Félix Hauri - <fe...@f-hauri.ch> - http://www.f-hauri.ch