aboutsummaryrefslogblamecommitdiff
path: root/bash/bash_logout
blob: 8d703a79d4fda57c605a96018c48283b3e6ede63 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                          
          

                                                           
              

  
                                            
                        
                                
  
 


                                                      
# Ensure we're using at least version 2.05
if ! test -n "$BASH_VERSINFO" ; then
    return
elif ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} == 2)) \
    && ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 4)) ; then
        return
fi

# Clear console if possible when logging out
if ((SHLVL == 1)) ; then
    clear_console -q 2>/dev/null
fi

# Write PWD to a file if set
printf '%s\n' "$PWD" > "${OLDPWD_FILE:-$HOME/.oldpwd}"