1

I've got a nice PS1 prompt that I want to only be used when user 'gatty' uses su for root.

PS1='\[\e[32m\]#\[\e[37m\] '

When other users like 'george' etc login, I want them to get the standard PS1 instead of 'gattys'.

Is this possible, how would I go about doing this?

Thanks!

0
0

In root's .bashrc, check the contents of /proc/self/loginuid, and set your custom PS1 variable only if it equals your UID.

1
  • Works perfect! Thank you :D – gatty Sep 8 '19 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.