We can use printf
to highlight individual arguments and inspect how the shell tokenizes them. For the command in question vs. the corrected variant in my answer to the linked question (tested in Bash and Dash):
$ printf '"%s"\n' sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
"sudo"
"add-apt-repository"
"deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty stable"
and
$ printf '"%s"\n' sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
"sudo"
"add-apt-repository"
"deb [arch=amd64] https://download.docker.com/linux/ubuntu trusty stable"
Oh well, that's not so different. However, this is not what ended up in the repository sources file for the author of the linked question:
Error: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu \ xenial \ stable' invalid
I don't know how that happened but it certainly looks like an issue with the back slashes at the line ends. From where else would they come? Maybe the author actually entered a different command or they used a different shell interpreter.