diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-19 23:58:25 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-20 00:07:15 +1200 |
commit | 88e4b992d90f2a7283058a1a93c388a9576bad5b (patch) | |
tree | e1716501ae3f3ebef491065885df56a81eeeb377 /sh/profile | |
parent | Remove debugging code from eds(1) (diff) | |
download | dotfiles-88e4b992d90f2a7283058a1a93c388a9576bad5b.tar.gz dotfiles-88e4b992d90f2a7283058a1a93c388a9576bad5b.zip |
Move OLDPWD setting to POSIX sh dir
With an attempt at correct trapping; may still require tweaking
Diffstat (limited to 'sh/profile')
-rw-r--r-- | sh/profile | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -9,6 +9,21 @@ for sh in "$HOME"/.profile.d/*.sh ; do done unset -v sh +# Trap on exit to run ~/.logout if it exists +logout_trap() { + if [ -f "$HOME"/.logout ] ; then + . "$HOME"/.logout + fi + if [ "$1" != EXIT ] ; then + trap - "$1" + kill "-$1" "$$" + fi +} +for sig in EXIT HUP INT TERM ; do + trap "logout_trap $sig" "$sig" +done +unset -v sig + # If ENV is unset after running those scripts and ~/.shrc exists, set it as ENV if [ -z "$ENV" ] && [ -f "$HOME"/.shrc ] ; then ENV=$HOME/.shrc |