From 850ae92cb4ea40ac9d645f8f5a6ca643c872928a Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Thu, 3 Oct 2019 19:39:35 -0400 Subject: Return to a more sane prompt --- shell/ash | 17 ++++++++--------- shell/bash | 38 ++++++++++++++++++++++++-------------- 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 -- cgit v1.2.3