$ od -c [Hit left arrow] ^[[D 0000000 033 [ D \n 0000004 $ od -c [Hit right arrow] ^[[C 0000000 033 [ C \n 000000 expect.test script: #!/usr/bin/expect -f spawn /bin/bash interact { "\033\[C" {exp_send "\033\[C"; send_user "Right Arrow Pressed\n"} # Right Arrow "\033\[D" {exp_send "\033\[D"; send_user "Left Arrow Pressed\n"} # Left Arrow } Running the script: $ ./expect.test spawn /bin/bash $ [Hit right arrow] Right Arrow Pressed [Hit left arrow... no output but the key does work and moves the cursor]