Similar to a post about cd, I've overwritten exit to do the following:
function exit() { $HOME/script.sh && builtin exit "$@"; }
Though this works as expected when exit is called directly, when the shell is exited via CTRL-D, this does not execute, OR, if it does execute, the script doesn't manage to finish.
What gives? Is some method other than exit called when CTRL-D is used?