#!/usr/bin/env bash
# ~/.bash_logout
# Made on SDF
# xmpp:[email protected]
# mailto:[email protected]

# Take out the trash-------------------------------------------------- #
 TRASHDIR=~/.trash
 TMPDIR=~/tmp
 # 1. If trash exists, remove old trash dir.
 [[ -d "${TRASHDIR}" ]] && /bin/rm -rf "${TRASHDIR}"
 # 2. If the above happened, ${TMPDIR} becomes new trash dir.
 #    If that's impossible, just create the new trash dir to replace the old.
 (( $? == 0 )) && [[ -d "${TMPDIR}" ]] && ( mv "${TMPDIR}" "${TRASHDIR}" || mkdir "${TRASHDIR}" )
 # 3. If the above happened, create new ${TMPDIR} to replace the old.
 (( $? == 0 )) && [[ ! -d "${TMPDIR}" ]] && mkdir "${TMPDIR}"

# Remove some useless files------------------------------------------- #
 garbage=(
   ~/.lesshst
   ~/.wget-hsts
   ~/.gopherrc
   ~/.viminfo
 )

 for f in "${garbage[@]}"
 do
   [[ -e "${f}" ]] && command rm -rf "${f}"
 done

# Tomb---------------------------------------------------------------- #
 # if type -P tomb &>/dev/null
 # then
        #  tomb slam all
 # fi