export thanked="1"
SPOOKY="▒▒▒░░░░░░░░░░▄▐░░░░
▒░░░░░░▄▄▄░░▄██▄░░░
░░░░░░▐▀█▀▌░░░░▀█▄░
░░░░░░▐█▄█▌░░░░░░▀█▄
░░░░░░░▀▄▀░░░▄▄▄▄▄▀▀
░░░░░▄▄▄██▀▀▀▀░░░░░ if you see this ascii art while using tty
░░░░█▀▄▄▄█░▀▀░░░░░░
░░░░▌░▄▄▄▐▌▀▀▀░░░░░ you have been visited by shell skeleton
░▄░▐░░░▄▄░█░▀▀░░░░░          of the return code %d
░▀█▌░░░▄░▀█▀░▀░░░░░
░░░░░░░░▄▄▐▌▄▄░░░░░ good scripts and commands will come to you
░░░░░░░░▀███▀█░▄░░░
░░░░░░░▐▌▀▄▀▄▀▐▄░░░ but only if you command
░░░░░░░▐▀░░░░░░▐▌░░ 'thank mr skeltal' on this message
░░░░░░░█░░░░░░░░█░░
░░░░░░▐▌░░░░░░░░░█░
"

spook () {
	printf "$SPOOKY" "$?"
	export thanked="0"
}

thank () {
	if ! [ "$1" = mr ] || ! [ "$2" = skeltal ]; then
		echo "who is this $* you're trying to thank?" >&2
		return 1
	fi
	export thanked="1"
	echo ':^)'
}

check_spooky () {
	local ret=$?
	if [ $thanked -eq 0 ]; then
		echo -e "\033[5;31mSP00KED\033[0m "
	elif [ $spooky ] && [ $ret -ne 0 ] && [ $thanked -eq 1 ]; then
		export thanked="0"
		printf "$SPOOKY" "$ret"
	fi
}

PS1="\$(check_spooky)$PS1"

exit () {
    echo -e '▒▒▒░░░░███░░░▄▐░░░░
▒░░░░░▄███▄░▄██▄░░░
░░░░░░▐▀█▀▌░░░░▀█▄░
░░░░░░▐█▄█▌░░░░░░▀█▄
░░░░░░░▀▄▀░░░▄▄▄▄▄▀▀
░░░░░▄▄▄██▀▀▀▀░░░░░
░░░░█▀▄▄▄█░▀▀░░░░░░        \033[5;31mMR BONES SAYS\033[0m
░░░░▌░▄▄▄▐▌▀▀▀░░░░░
░▄░▐░░░▄▄░█░▀▀░░░░░
░▀█▌░░░▄░▀█▀░▀░░░░░        \033[5;31mTHE RIDE NEVER ENDS\033[0m
░░░░░░░░▄▄▐▌▄▄░░░░░
░░░░░░░░▀███▀█░▄░░░
░░░░░░░▐▌▀▄▀▄▀▐▄░░░
░░░░░░░▐▀░░░░░░▐▌░░
░░░░░░░█░░░░░░░░█░░
░░░░░░▐▌░░░░░░░░░█░
'
}

one_more_ride () {
	if [ $spooky ]; then
		exit
		$SHELL
	fi
}

trap one_more_ride 0
