1

Just moved over to ubuntu land from fedora (wanted try the budgie build). I'm fed land I had a script (from Fedy - posted below.) that changed my prompt to red when I logged into the root shell with sudo -s, this doesn't appear to work in Ubuntu even though I have the following the /etc/sudoers file:

Defaults        env_reset

Could one of you kind folks point out what is blocking or overwriting the export PS1?

Output of cat /etc/profile.d/color_prompt.sh:

# Colors in Terminal (Bash)
if [[ ! -z \$BASH ]]; then
    if [[ \$EUID -eq 0 ]]; then
        PS1="\[\033[33m\][\[\033[m\]\[\033[31m\]\u@\h\[\033[m\] \[\033[33m\]\W\[\033[m\]\[\033[33m\]]\[\033[m\] # "
    else
        PS1="\[\033[36m\][\[\033[m\]\[\033[34m\]\u@\h\[\033[m\] \[\033[32m\]\W\[\033[m\]\[\033[36m\]]\[\033[m\] \$ "
    fi
fi
  • 1
    Don't use sudo -s to login as root. Use sudo -i and get clean environment. – muru Apr 14 '17 at 13:51
  • -i, and that might be a difference between Fedora & Ubuntu. – JonBrave Apr 14 '17 at 13:53
  • ahh, yeah that behaves differently in the redhat land. Thanks for pointing that out and for the article explaining the difference – the_frank Apr 14 '17 at 14:00
  • I think you should use == in the test instead of -eq – Zanna Apr 14 '17 at 14:01
  • @Zanna == is string comparison, -eq is integer comparison, which throws an error if one of the candidates can not be interpreted as a number. I think both ways are acceptable here. – Byte Commander Apr 14 '17 at 14:10
  • the script is the one being taken from the fedy package (fixbashcolor.sh). The have a github I'm sure they'll love the comments. The script works fine though. – the_frank Apr 15 '17 at 18:20

0 Answers0