Eg. when you're running nice things like Perl or Ruby REPLs, you have code/command completion exposed via GNU Readline. What I want to do is set some elisp/env variable when entering/exiting such a program to indicate that I want shell-mode to pass the TAB key onto those programs.
Note that C-q TAB also does not work, so I think that Readline is also ignoring it because TERM=dumb, but setting it to eg. vt100 also doesn't do the trick, so it might even be looking at EMACS=t.