bash-prompt-generator icon indicating copy to clipboard operation
bash-prompt-generator copied to clipboard

Use single quotes `'` instead of double quotes `"`

Open Znuff opened this issue 1 year ago • 0 comments

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 ~ $

Znuff avatar Nov 10 '23 20:11 Znuff