cmc-csci143
cmc-csci143 copied to clipboard
Question about Quiz Practice: Shell 1
I am a bit confused regarding the result of Problem 19. @mikeizbicki
I typed in the command and got the result: echo.
lambda-server:~/quiz $ cd; rm -rf quiz; mkdir quiz; cd quiz
lambda-server:~/quiz $ var=$(echo $(echo echo))
lambda-server:~/quiz $ touch "$var"
lambda-server:~/quiz $ ls
echo
I wonder whether the result to be echo instead of 'echo', since the result from Problem 15 to Problem 18 are all including single quotes. Is that because echo is a single word?
Correct. ls adds the single quotes around the output only when there is a space in the filename. If there is no space in the filename, no quotes are added.