substituting a value of a given variable in another.
That description is wrong on several counts. Variable substitution replaces the name of a variable (plus some syntactic fluff) by its value. Furthermore, it does not operate “in” a variable, but in a command. The command could be one that sets the value of a variable, but that's just one case among many.
For example, the command
echo $foo displays the value of the variable. The source code contains
$foo, and the corresponding output contains the value of the variable
The reason this is called “variable substitution” is that the shell operates by a series of transformations of strings (and lists of strings). For example (simplified), consider the command
ls -l $dir/*.$ext. To evaluate it, several things happen in sequence:
- The shell starts to parse the command and splits it into three words:
- In the third word, the shell sees two variable substitutions to perform (that's what the dollar signs mean in this context). Say that the value of
/some/path and the value of
txt, then the shell rewrites
/some/path/*.txt. This is a substitution because the value of each variable is substituted for the dollar-name syntax.
- The shell expands the wildcard pattern
/some/path/*.txt to the list of matching file names.
- The shell executes
ls with the arguments that it's computed.
$foo does more than substitute the value of a variable but that's another story.)
In most programming languages, to take the value of a variable, you just write the variable's name. The shell is designed for interactive use; if you write a name it's interpreted as a literal string. That's why the syntax to take the value of a variable has an extra marker to say “I want to take a variable's value”.
Why is this action need a special term, why can't we just say a Bash programmer changes a variable's value with editing it manually in Vim or Nano or sed?
Variable substitution has nothing to do with changing the value of a variable. Changing the value of a variable is an assignment.
Of course an assignment can contain variable substitutions, like any other command. But variable substitutions are not designed specifically for assignments.
Furthermore you can't change the value of a variable with an editor. A variable has a value in each process, it isn't a system configuration. You can have configuration files that set the initial value of a variable, but after that the value can change.