Say I have a process running in a terminal in the foreground. While it is active I can type commands, hit return, and those will be executed once the process is done.
Now say furthermore I would like to input control characters instead of just "normal" letters. For some reason those control characters are echoed literally but not interpreted properly once the foreground process finishes.
Allow me to illustrate this problem with an example:
deso@XXX ~ $ sleep 10 echo test deso@XXX ~ $ echo test test
While sleep is active I type 'echo test' (followed by return) and it gets executed after 10 seconds. Now in the same terminal I do (this is the literal output I see):
deso@XXX ~ $ sleep 10 ^R echo deso@XXX ~ $ echo deso@XXX ~ $
My intention here is to invoke the readline's reverse history search feature while sleep is active (this should find the 'echo test' I entered before). If the shell is waiting for my input Ctrl-R accomplishes this feat. With an active process the Ctrl-R is seemingly ignored (at least it does not start the reverse history search). This is all on Linux (with xterm + tmux + bash; but I tried without tmux and with busybox instead of bash).
Now what is interesting is that on VMware ESX (which uses busybox, i.e., ash, as the shell) things work as expected, that is, the control character is not echoed literally but rather accepted as a control character and interpreted (along with the remaining characters) once the foreground process is done. That means in the example above the history search would have been invoked, the last 'echo' command ('echo test') would be found and it would be executed.
My question is: who influences this behavior? The terminal, the shell, the kernel? Is there a way to get Linux to behave like ESX in that respect? As I mentioned I have tried the same experiment with different shells (bash & ash) and different terminal emulators (xterm & urxvt). The behavior is always the same.