If I'm in a
bash shell, because of how
stty is set up, typing Ctrl+D will send an
bash, which will then do pretty much the same thing as the command
exit does, and exits the shell.
I'm wondering if there's some way I can temporarily re-map it so that
bash does not exit upon recieving an
EOF, but instead executes some other command of my choosing.
My motivation is that I'm using Python virtualenvs (through
workon foo will enter the virtualenv, and
deactivate will leave the virtualenv.
deactivate can be used for clean-up, but when I Ctrl+D, it skips that step.
If I could make it so that Ctrl+D either (A) ran
deactivate and just exited the virtualenv (and re-mapped Ctrl+D to
exit again) so I could continue my shell, or (B) ran
deactivate and then
exit so it would still exit the shell but the clean-up would be performed, that would be great.