Rishabh Rishabh - 23 days ago 8
Linux Question

error while running expect in unix

Getting error while running expect script in bash script

Input:

{

/usr/bin/expect << EOF

spawn ssh execsped@10.150.10.194 "cd /home/execsped/ram_test_72;./testecho.sh \"$evenno\" \"$eisinno\" \"$efilename\""

expect "Password"

send "abc@123\r"

expect "*#*"


EOF

}

Output:-

extra characters after close-quote

while executing


"spawn ssh execsped@10.150.10.72 "cd /home/execsped/evoting_test_72;./testecho.sh "10575" "_eVoting.pdf" "abc.pdf"
"

Answer

remove the escaped quotes. look at the final command it's trying to run: "cd /home/execsped/evoting_test_72;./testecho.sh "10575" "_eVoting.pdf" "abc.pdf" " it should run fine without the escaped quotes.