1. Problem description:
I have a script which needs to ssh to an remote server and run some scripts.
But I met some troubles when trying to use values that defined in remote server.
I use "\$" to refer to the value defined in remote server but it says the value is not defined...
2. Error message:
3. Script:
#!/bin/bash
myusrname="xxx"
myhost="xxx"
mypsword="xxx"
/usr/bin/expect<<-EOF
spawn ssh -o "StrictHostKeyChecking=no" $myusrname@$myhost
expect "*password*"
send "$mypsword\r"
expect "*#*"
send "tst=\"just a test string\"\r"
expect "*#*"
send "echo \$tst\r"
EOF