#
# $USER/.bash_logout skeleton script from the Anonymizing Unix Project
# by van Hauser / THC <vh@reptile.rug.ac.be>
#

echo -e "\007Goodbye ..."

#
# If the number of user's login shells are < 3 then this is the last one.
shells=`ps xu | grep -- "$USER .* S .* -[^ ]*sh" | wc -l`
test $shells -lt 3 || exit 0

#
# If the file $HOME/.keep exists, the CFS homedir won't be unmounted. This is
# useful if you run a background job and log off.
if [ -e $HOME/.keep ]; then
    rm -rf $HOME/.keep
    echo "Deleted $HOME/.keep - your CFS homedir won't be unmounted this time."
    sleep 5
    exit 0
fi

#
# Detaching ...
export HOME=/
cd /
cdetach $USER

if [ -x /usr/bin/fortune ]; then
    /usr/bin/fortune -o -w
fi

# done
