Root .bashrc
Hi,
I have modified my user .bashrc and wanted to have my root bash look the same so I copied my user bashrc to /root. Works fine except for the hash sign. Instead of a # sign I get a 1. This is driving me crazy. Why is this happening ? Code:
PS1="\u"; # username |
|
But if I write \$ I get the $ sign as root. I want the # sign as root.
|
So you're not doing the quotes and backslashes right. You need backslash-dollar in PS1. If you write PS1+="\$" then the backslash will disappear, because it's protecting the dollar.
Either of these will work: PS1+='\$ ' PS1+="\\\$ " |
Quote:
Code:
PS1='\$ ' |
Hello,
Quote:
Code:
$ PS1="\u at \h in \W\n# " SeB |
Okay, now I works. I was not aware that there was a difference between single and double quotes.
|
Member response
Hi,
I test for root or user to set the prompt. Notice the 'id' check via 'if' below; Code:
#.bashrc Have fun & enjoy! :hattip: |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 06:39 PM. |