etc/profile: Add kallisti5's smiley-face $? indicator and use $ not >.

An example of the new prompt line format is:

~/Desktop/haiku :) $

Or if the last command exited in failure:

~/Desktop/haiku :( $

The smiley-face will be either dark green or red, also depending on
the command status.

I realize this could be a tad controversial, especially for those used
to the old prompt, but it seems to be a pretty useful feature to me
(and of course kallisti5 came up with it.) But if the bikeshed turns
out to be too large, we can revert it and deal with it after the beta.

As for $ vs > -- BeOS R5 used $, most modern Linux uses $, and having >
come after a space looks much stranger.
This commit is contained in:
Augustin Cavalier
2018-08-21 21:13:51 -04:00
parent d37ae86568
commit 9d1582e31a
+6 -3
View File
@@ -1,18 +1,21 @@
#
# Administrative startup for /bin/sh
# Place user customizations in /.profile
# Place user customizations in ~/config/settings/profile
#
ARCH=`getarch 2>/dev/null`
if [ "$ARCH" = "`getarch -p 2>/dev/null`" ] ; then
echo -e "\nWelcome to the Haiku shell.\n"
export PS1="\w> "
PS1="\w "
else
echo -e "\nSwitching to architecture `getarch`\n"
export PS1="[$ARCH] \w> "
PS1="[$ARCH] \w "
fi
unset ARCH
PS1="$PS1"'`if [ $? = 0 ]; then echo "\e[32m:)\e[0m\]"; else \
echo "\e[31;1m\]:(\e[0m\]"; fi` \e[0m\]$ '
export USER=`id -un`
export GROUP=`id -gn`