I finally figured this out. What pointed me in the right direction was when I remembered that the echo
command is internal to bash. Changing the command to /bin/echo completely changed the behavior. This was only part of the solution.
Seeing that it appears that bash itself is the problem I looked through the man page to see what the cause may be. Then it hit me! Bash uses readline support and sure enough disabling it fixes your problem regardless of using /bin/echo or the internal echo command.
Just change your spawn line to spawn = pexpect.spawn('/bin/bash --noediting')
.