Substituir:
ssh -q [email protected] << EOF
com:
ssh -q [email protected] <<'EOF'
Isso impede que o shell no lado do cliente expanda o documento here. O script ainda será expandido no lado do servidor.
Documentação
De man bash
:
The format of here-documents is:
[n]<<[-]word here-document delimiter
No parameter and variable expansion, command substitution, arithmetic expansion, or pathname expansion is performed on word. If any part of word is quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and '. [Emphasis added]