I recently converted a shell script from bash to zsh and got a strange error. I had a command like
HOST="User@1.1.1.1"
scp "$BASE_DIR/path/to/file" $HOST:some\\path
This worked fine in bash, but zsh failed with a bad substitution. I fixed this by change $HOST
to ${HOST}
, but I'm curious as to why this was necessary. Also, strangely, I had a few such scp commands, and all of them "worked" except the first one. However, I ended up with a file called User@1.1.1.1
on my filesystem which was really unexpected. Why did this subtle change make such a big difference?