The surrounding quotes actually unquote this. Remove or escape them
14# Setup docker repo.
15echo \
16 "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
17 "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \18 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
19# Install docker.
20sudo apt-get update
The surrounding quotes actually unquote this. Remove or escape them
13sudo chmod a+r /etc/apt/keyrings/docker.gpg
14# Setup docker repo.
15echo \
16 "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \17 "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
18 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
19# Install docker.
Description
Problematic code:
echo "You enter "$HOSTNAME". You can smell the wumpus." >> /etc/issue
Preferred code:
echo "You enter $HOSTNAME. You can smell the wumpus." >> /etc/issue
Always quoting variables and command expansions is good practice, but blindly putting quotes left and right of them is not.
In this case, the quotes around the expansion are unquoting it, because the left quote is terminating an existing double quoted string, while the right quote starts a new one:
echo "You enter "$HOSTNAME". You can smell the wumpus."
|----------| |---------------------------|
Quoted No quotes Quoted
If the quotes were supposed to be literal, they should be escaped. If the quotes were supposed to quote an expansion (as in the example), they should be removed because this is already a double quoted string.