From: Nicolas Boisselier Date: Wed, 25 Oct 2017 22:20:35 +0000 (+0100) Subject: etc/profile.d/ps1.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=3893e6a91c0a60d16a84e237d5fdfa3823e502d7;p=nb.git etc/profile.d/ps1.sh --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 33765a95..742a02f3 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -891,11 +891,12 @@ uid_from_to() { eval "$cmd" } -colorsls() { +lscolors() { local color=16 while [ $color -lt 245 ]; do - echo -e "$color: \\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m" + echo -ne "$color: \\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m" + printf '\t%s\n' "\\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m" ((color++)); done } diff --git a/etc/profile.d/ps1.sh b/etc/profile.d/ps1.sh index c1f5e718..6a7ef6ec 100644 --- a/etc/profile.d/ps1.sh +++ b/etc/profile.d/ps1.sh @@ -3,35 +3,7 @@ # if is_prompt 2>/dev/null; then - case "$SHELL_NAME" in - bash) - - h='\h' - color='' - char='$'; [ $UID = "0" ] && char='#' - - case "`hostname -f`" in - pi*) color=31 ;; - # ovh - yellow - #*.ovh.net|*.kimsufi.com|*.ip-*.eu) color=33 ;; - # mac - magenta - Nicolas-Boisselier-MacBook*) h="macbook"; color=35 ;; - MacMini*) color=35 ;; - *.semantico.net|dev*|cst*|csp*|isp*|Nicos-MacBook-Pro.local) color=32 ;; - *) color='' ;; - esac - - if [ -n "$color" ]; then - if [ "$color_prompt" = yes -a -n "$color" ]; then - PS1="\[\033[01;${color}m\]\u@$h:\[\033[00m\]\W${char} " - else - PS1="\u@\h:\W${char} " - fi - fi - - unset h color char - ;; - esac + PS1="\u@\h:\W${char}" + [ $UID = "0" ] && PS1="$PS1# " || PS1="$PS1\$ " fi -