Bash - Escaping SSH commands
If both sides are using bash, you can escape the arguments using printf '%q '
, eg:
ssh [email protected] "$(printf '%q ' mv -v "/home/dan/Downloads/complete/$dir" /home/dan/Downloads/downloaded)"
You need to quote the whole expression ssh user@host "command"
:
ssh [email protected] "mv -v /home/dan/Downloads/complete/$dir /home/dan/Downloads/downloaded"