I meet problem with executing expect command with bash variable. I have location given by parameter of the script and I need to use it in send command via expect -c. But I need to give it with " so actually send command is thinking that I've ended typing and is recognizing rest of command as extra characters after close-quote. Thing is like:
#!/bin/bash
SIGN=ppp
expect -cd 'spawn ssh user@host
expect "Password:"
send -- "pass\r"
expect "*~>"
send -- "find /local/"$SIGN"/ -maxdepth 1 -type d -mtime +30 |xargs rm -rfv\r"
expect "*~>"
send -- "exit\r"'
Any idea how to send the variable from bash to expect without double-quotes? BTW - I cannot use keys for ssh