couldn't read file :expect error in a bash script -


this question has answer here:

i facing error in below expect embedded bash script. when run it,i below error , script ends though giving arguments on commandline.the expect send unable $site variable

./expect_delete "password" usa rvomero 

"enter site name username: couldn't read file "site": no such file or directory"

the script:

#!/bin/bash password="$1" me=`whoami` site="$2" list="$3" echo $site $list in `echo $list` /tools/cfr/bin/expect -c " set timeout 10 spawn <fullpathtoanotherbashscript> $site $i expect "enter site name $me: " send "$site\r" expect "enter password $me: " send "$password\r" expect eof " done 

any appreciated

you might better off encapsulating expect script in ' there isn't shell expansion going on , getting variables in exporting them -

export user=fred  expect -c '   set user $env(user)   .... ' 

Comments