Well, yes. At the time the variable substitution occurs, the variable has not been set yet. eg.:
$ quux=foo echo $quux $
"Fix" it by separating the one command into 2:
$ quux=foo; echo $quux foo $
It isn't just bash, BTW. Any Bourne-compatible shell should behave like this.
🦛
In reply to Re^5: Indirect variable expansion
by hippo
in thread Indirect variable expansion
by mvanle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |