summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-10-26 23:48:02 -0700
committerxyz <gky44px1999@gmail.com>2021-10-26 23:48:02 -0700
commit7f2a73cdd8add791f50eb68771f9537ce2071e1a (patch)
treeb60545b9f5dfe4fd18c6e4dc9b25574d0336ba22
parent372ba0607b1200f18cf07e7aae68ef6e1e75b5dc (diff)
use tput for bashrc PS
-rw-r--r--home/xyz/.bashrc12
1 files changed, 10 insertions, 2 deletions
diff --git a/home/xyz/.bashrc b/home/xyz/.bashrc
index 43e7e8d4..ebf8774a 100644
--- a/home/xyz/.bashrc
+++ b/home/xyz/.bashrc
@@ -15,11 +15,19 @@ esac
# default PS1
#PS1='[\u@\h \W]\$ '
+# depreciated
# 0: not bold, 91: bright red
# \e[m act like \e[0m, means reset so commands after it will not be colored
# https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit
-# need \[ and \] around color codes so bash ignore color codes when calculating line wraps
-PS1='\[\e[0;91m\][\u@\h \W]\$ \[\e[0m\]'
+# need \[ and \] around color codes so bash ignore color codes when calculating line wraps?
+# https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/#:~:text=you%20also%20need%20to%20put%20%5C%5B%20and%20%5C%5D%20around%20any%20color%20codes%20so%20that%20bash%20does%20not%20take%20them%20into%20account%20when%20calculating%20line%20wraps.
+#PS1='\[\e[0;91m\][\u@\h \W]\$ \[\e[0m\]'
+# \033 can be used for dash printf, but \e can't? not sure why
+#PS1='\[\033[0;91m\][\u@\h \W]\$ \[\033[0m\]'
+
+# tput is better for different terminals?
+# setaf and sgr0 see `man terminfo`
+PS1="$(tput setaf 1)[\u@\h \W]\$ $(tput sgr0)"
# https://github.com/LukeSmithxyz/voidrice/blob/master/.config/shell/aliasrc
for cmd in iotop nethogs hardcode-fixer ventoy; do