Help with a logout scrpt

Hi, I'm new to Linux and this forums. I was working on a logout script
and was wondering if anyone could help me out.

What I'm trying to do is to delete the content of the ~/tmp/ directory
and also to perform a check if any processes are currently running befor logout.

this is what I have

# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy

if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

ps -u `whoami` | grep -v $$ | grep -v 'PID TTY'

if ( $? == 0 ) then
echo ""
echo "WARNING - YOU HAVE RUNNING JOBS!"
echo ""
echo "press return to log out"
read answer

endif

rm -rf /tmp/*
rm -rf/var/tmp/*

but it doesn't seem to work

~ refers to your home directory, however, the commands you wrote are to delete the files you own in /tmp and /var/tmp.

That would also be counter intuitive, as you could simply cron the deletion.