New to BASH and Linux and need some quick help. I have written a quick bash script that asks the user for a username and password from the command line and passes that info to a remote server later via SSH. Problem is, one user has a ' character in the password and the value is causing EOF errors when using SSH. The following is my code to capture the username and password
echo "Please type in username:"
read username
read -s -p "Enter Password: " password
and the following is where I send the information to the remote server. Note, there is an array of servers I must send this to.
echo "Adding username and password..."
ssh root@${dssAssocArray[$key]} "echo username=$username > /etc/smbcredentials"
ssh root@${dssAssocArray[$key]} "echo password=$password >> /etc/smbcredentials"
Is there some simple way to dereference the ' (if that's the correct term) or any other special character that might cause an escape?