It works great when I use expect interactively like this:
root@vagrantup:/home/vagrant> expect -i
expect1.1> spawn screen -x
spawn screen -x
3195
expect1.2> send "ls\n"
expect1.3> exit
But the same commands used in a file:
spawn screen -x
send "ls\n"
exit
Only works sometimes, eg. 1/10 time every time I execute the file. It's really weird.
I execute the file with this command:
expect -f Expectfile
I have also tested these:
expect -b Expectfile
expect Expectfile
But I get the same error.
It doesn't say anything. The other screen (since I'm using "screen" command) only responds sometime. Anyone knows why?