xta / HalloweenBash

Custom Bash Profile Generator
http://xta.github.io/HalloweenBash/
333 stars 32 forks source link

Escape $ so it becomes # after switching to root #21

Closed breun closed 11 years ago

breun commented 11 years ago

When using "\$ " as the end of my PS1 string on OS X, the $ doesn't change into a # after switching to root.

I have to either change it to "\$ " or use single quotes around the exported PS1 string.

xta commented 11 years ago

Hi @breun,

Thanks for your feedback. I'm not sure I understand the issue or situation. Your .bash_profile goes in the user's ~/. Are you setting your user PS1, but it is also changing the root user's PS1?

Could you provide specific step-by-step details to reproduce the bug?

Thanks

breun commented 11 years ago

I'm running OS X 10.8.4 with bash 4.2.45(2)-release (i386-apple-darwin12.3.0) from MacPorts.

  1. Go to http://xta.github.io/HalloweenBash/
  2. Put the default generated code export PS1="\h:\W \u\$ " into ~/.bash_profile.
  3. Open a new terminal window.
  4. Run sudo -s.
  5. The $ is still a $, but should change into a # to indicate you're now running as root.

When using either export PS1="\h:\W \u\\$ " or export PS1='\h:\W \u\$ ' this does work.

xta commented 11 years ago

Sorry for the delay, but I've taken the \$ route - Thanks @breun