How to escape Special Characters in Expect programming?

view full story

http://www.unix.com – Hi, I have written a unix expect utility "ssh-login.exp" which connects (ssh) to remote host and execute some shell script. I am calling this "ssh-login.exp" utility from another shell script. "ssh-login.exp" takes username, password, host and shell script path to execute on remote host. All works fine for alphanumeric password. If password has any special characters like "$" this "ssh-login.exp" doesn't work. I have already added code to add escape character before any special characters password may have. e.g. for password string "we (HowTos)