3 ms·
It's specifically an edge case with variable assignment. If it were export val="$( ... )" you'd need the quotes again. You don't need quotes in plain variable
by nijave 5y ago
It's specifically an edge case with variable assignment. If it were
export val="$( ... )"
you'd need the quotes again. You don't need quotes in plain variable assignments and afaik it goes back to how space splitting works in Bash (whether or not you're in a "splitting context" or whatever the docs call it). There's a semi-related set of rules for when * gets expanded and when it's passed through to the underlying command as a literal '*' character
- jolmg 5y ago> If it were `export val="$( ... )"` you'd need the quotes again. No. That's also recognized as an assignment by bash[1]: > PARAMETERS... A variable may be assigned to by a statement of the form `name=[value]`... Word splitting is not performed... Assignment statements may also appear as arguments to the alias, declare, typeset, export, readonly, and local builtin commands (declaration commands). [1] https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameters https://www.gnu.org/software/bash/manual/bash.html#Shell-Par...