Is there a simple way to require confirmation before logging out of a shell, and to prevent the shell from exiting if confirmation is denied? This would be useful to avoid accidentally terminating an SSH session used for tunneling.
The problem with
trap ... EXIT is it still exits after completing the trap. The most promising solution I found so far is described in confirmed exit using trap, which discusses ctrl+c but seems like it could be made to work for ctrl+d instead.