Can someone help me on my below request please. I'm trying to send password from a file to execute a script on remote machine, however it is giving error as
Password: can't read "sys_pw": no such variable while executing "send "echo $sys_pw\r""
here is my code..
#!/bin/bash
sys_pw=`cat /home/admin/scrp/sys.pw`
expect -c 'spawn ssh admin@<servername> -o StrictHostKeyChecking=no "df -Ph"; expect "Password:"; send "$sys_pw\r"; interact'
expect
?