bash-prompt-generator
bash-prompt-generator copied to clipboard
Use single quotes `'` instead of double quotes `"`
Using " " with \$ prevents it from interpreting correctly for root user(s), where \$ should render as # and not $.
Example:
root@layer ~ $ export PS1='\[$(tput setaf 33)\]\u\[$(tput setaf 69)\]@\[$(tput setaf 105)\]\h \[$(tput setaf 141)\]\w \[$(tput sgr0)\]\$ '
root@layer ~ # export PS1="\[$(tput setaf 33)\]\u\[$(tput setaf 69)\]@\[$(tput setaf 105)\]\h \[$(tput setaf 141)\]\w \[$(tput sgr0)\]\$ "
root@layer ~ $ export PS1='\[$(tput setaf 33)\]\u\[$(tput setaf 69)\]@\[$(tput setaf 105)\]\h \[$(tput setaf 141)\]\w \[$(tput sgr0)\]\$ '
root@layer ~ # export PS1="\[$(tput setaf 33)\]\u\[$(tput setaf 69)\]@\[$(tput setaf 105)\]\h \[$(tput setaf 141)\]\w \[$(tput sgr0)\]\$ "
root@layer ~ $