Not to Escape Backslash in script

Hello Folks,
I am looking for a bash script which check the ftp server connection status and transfer success/failure also final stage is like if the transfer/connection failed, i should get an email.

First stage - checking for login success or not

#!/bin/bash
HOST='your.ftp.site'
USER=apac\remoteusername'
PASSWD='remotepasswd'

ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd upload
ls -la
bye
EOT

But this escapes the '\' in $USER and consider it as apacremoteusername

Kindly help me how to accept '\' for user command? Or any other command which accepts '\'

Thanks in Advance

Did you consider trying \\ ?

1 Like

Do you have

USER='apac\remoteusername'

i.e. ticks around the string?

\\ worked in .netrc file!