I am just wondering why do we need to use this command
why does the command not look like
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
If you do this:
bash sets VAR to "value", creating the variable, if it didn't exist.
If you write:
then bash executes this replacing $VAR by its current value. Say, $VAR had the value x, this would produce:
as the command to be executed. That's why it says "command not found"
However, bash can be told to reinterpret this via
VAR2=x VAR=VAR2 echo $VAR2 x eval $VAR=y echo $VAR2 y