I am trying to automate gdb with expect. My script will start gdb, do some initialisation, and then pass the control to the user. Expect's interact command seems like the perfect tool for the job.
Now consider:
$ echo "spawn gdb
expect \"(gdb) \"
send \"help\r\"
expect \"(gdb) \"
interact" | expect -
On my machines, this scriptlet spawns gdb, issues the help command, as expected. But then it immediately exits the script and returns me to the bash prompt. I would expect the user to stay within gdb and be able to issue commands.
Any idea what I am missing here?