Question 140
During an introductory open-source workshop, the task is: A shell user assigns NAME=Ana and runs echo "$NAME files" but confuses the braces used for disambiguating adjacent variable names. Which concept explains this observed result?
Explanation
Correct Answer
Braces tell the shell exactly where a parameter name ends so adjacent characters are not interpreted as part of that name. This explains the stated Linux behavior. The corresponding safe action is: Use echo "${NAME}_files" to delimit the variable when literal characters immediately follow it. Confirm it with: The displayed value has Ana followed by _files, rather than an empty or unexpected variable.
Incorrect Answers
The type built-in can distinguish shell built-ins, aliases, functions and executable paths. That principle governs the offered alternative, but the facts in this question are explained by: Braces tell the shell exactly where a parameter name ends so adjacent characters are not interpreted as part of that name. The two technical dependencies must be distinguished.
The alternate statement is relevant when a process inherits environment entries from its parent, not from unrelated sibling terminal sessions. Here the root condition follows: Braces tell the shell exactly where a parameter name ends so adjacent characters are not interpreted as part of that name. It is not the same causal explanation.
The alternative mechanism is: Unquoted whitespace separates command arguments before cd receives its directory operand. The present evidence instead rests on: Braces tell the shell exactly where a parameter name ends so adjacent characters are not interpreted as part of that name.