aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash17
-rw-r--r--shell/bash38
2 files changed, 32 insertions, 23 deletions
diff --git a/shell/ash b/shell/ash
index 0769478..dc8cce0 100644
--- a/shell/ash
+++ b/shell/ash
@@ -1,19 +1,18 @@
+color="no"
+case "$TERM" in
+ xterm*) color=yes;;
+ *256color) color=yes;;
+esac
+
case "$-" in
*i*)
set_pager
set_editor
setaliases
- function nonzero_return() {
- RETVAL=$?
- [ $RETVAL -ne 0 ] && echo "$RETVAL:"
- }
-
- export PS1="\`nonzero_return\`[\t] <\u@\H> \w \\$ "
-
- # Same thing but red user/host combo
+ export PS1="$ "
if [ $(id -u) -eq 0 ] ; then
- export PS1="\`nonzero_return\`[\t] <\[\e[31m\]\u\[\e[m\]\[\e[31m\]@\[\e[m\]\[\e[31m\]\H\[\e[m\]> \w \\$ "
+ export PS1="# "
fi
;;
*) return ;;
diff --git a/shell/bash b/shell/bash
index ae7d3b4..0dc9c97 100644
--- a/shell/bash
+++ b/shell/bash
@@ -1,8 +1,16 @@
+color="no"
+case "$TERM" in
+ xterm*) color=yes;;
+ *256color) color=yes;;
+esac
+
+if [ "$color" = "yes" ] ; then
+ colormanpages
+ setcolorterminal
+ setcoloraliases
+ setlscolors
+fi
-colormanpages
-setcolorterminal
-setcoloraliases
-setlscolors
set_pager
set_editor
set_go
@@ -14,14 +22,16 @@ export MANWIDTH=80
# checkSSHAgent
-function nonzero_return() {
- RETVAL=$?
- [ $RETVAL -ne 0 ] && echo "$RETVAL:"
-}
+case "$-" in
+*i*)
+ set_pager
+ set_editor
+ setaliases
-export PS1="\`nonzero_return\`[\t] <\u@\H> \w \\$ "
-
-# Same thing but red user/host combo
-if [ $(id -u) -eq 0 ] ; then
- export PS1="\`nonzero_return\`[\t] <\[\e[31m\]\u\[\e[m\]\[\e[31m\]@\[\e[m\]\[\e[31m\]\H\[\e[m\]> \w \\$ "
-fi
+ export PS1="$ "
+ if [ $(id -u) -eq 0 ] ; then
+ export PS1="# "
+ fi
+;;
+*) return ;;
+esac