Execute command with here documentsuggest change
ssh -p 21 email@example.com <<EOF echo 'printing pwd' echo "\$(pwd)" ls -a find '*.txt' EOF
$ is escaped because we do not want it to be expanded by the current shell i.e
$(pwd) is to be executed on the remote shell.
ssh -p 21 firstname.lastname@example.org <<'EOF' echo 'printing pwd' echo "$(pwd)" ls -a find '*.txt' EOF
Note: The closing EOF should be at the beginning of the line (No whitespaces before). If indentation is required, tabs may be used if you start your heredoc with
<<-. See the Indenting here documents and Limit Strings examples for more information.