diff --git a/.profile b/.profile
index 7eb8ac02..4fcdce12 100755
--- a/.profile
+++ b/.profile
@@ -99,6 +99,7 @@ fi
 # Set up a default PS1
 # This *should* work for all terminals. I know it works on ksh
 _ps1() {
+	exitcode="$?"
 	r="\e[0m"
 	fg_blue="\e[34m"
 	fg_red="\e[31m"
@@ -115,8 +116,7 @@ _ps1() {
 	cpwd="${PWD/#$HOME/\~}"
 	# Alert us if the last command failed
 	fail=""
-	exitcode=$?
-	if ! [ "$exitcode" ]; then
+	if ! [ "$exitcode" = "0" ]; then
 		fail="${fg_bold}${fg_red}?"
 	fi
 	printf "[${hostname_prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} "