Closed henrylong612 closed 9 months ago
The issue is that the $
substitutions will not get evaluated recursively. So your statement that
$ var="$(echo '$(echo) echo')"
should be equivalent to
$ var="$(echo) echo"
is incorrect. The
$
in the output of the firstecho
will never get evaluated by the shell.
I'd be happy to clarify further tomorrow before/after class.
Hi @mikeizbicki,
In the process of reviewing the answers for our previous in-class quiz, I have grown increasingly confused about problem 1, which reads as follows:
The output is
2
, and the corresponding files areecho
and'$(echo)'
. I am confused because the answer does not match what I would expect when I walk through the problem in smaller steps. To start,should be equivalent to
which should be equivalent to
When the final two commands run, I would expect the final output to produce one single file,
echo
. What am I getting wrong here? The only thing I can think of is that the first step somehow forces the shell to "remember" that the characters in '$(echo) echo' are always string characters and should never be evaluated as code. Thank you in advance for your help, and I'll see you tomorrow!Confusedly, Henry