diff --git a/NOTES.md b/NOTES.md index 1ad7b15..e02a0b6 100644 --- a/NOTES.md +++ b/NOTES.md @@ -213,6 +213,17 @@ The form is $VAR, where VAR may only contain the following characters: * _ * 0-9 (not in the first character) +Just noticed an interesting case: +```shell +bash-5.2$ VAR=hello # we set a shell variable (NOT environment variable) +bash-5.2$ VAR=hi env | grep VAR=; env | grep VAR= # here VAR is an environment variable, which is only valid for the next command (the second env returns nothing, confirming that it is not valid for that command) +VAR=hi +bash-5.2$ env | grep VAR= # var is not an environment variable +bash-5.2$ echo $VAR # but it is a shell variable +hello +``` +Luckily for us, we don't have to handle shell variables, nor do we have to handle `VAR=value` or `VAR=value cmd`. + #### Word Splitting cf. 3.5.7 Word Splitting