Re: Adding Color / colour to my prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Ward wrote:
Hello,

I want to have a promt that changes colour depending on the user that logs in.

I have added the following to the /etc/skel.bashrc and my other users
.bashrc files.

  if [ "$USER" == "root" ]; then
    PS1="\[\033[0;31m\]\u@\h:\w\\$\[\033[0;37m\] "
  else
    PS1="\[\033[0;32m\]\u@\h:\w\\$\[\033[0;37m\] "
  fi

this works great through putty but when using a gui the font changes
to grey which is hard to read, this is due to the ansi color 37m, how
can I add a check to see if I am using a putty terminal session or an
X terminal session?

Any one got any other great tips for changing the prompt?

Paul

Try to check environment variable TERM.

if [ x"$TERM" = xxterm ]; then
   ## X terminal session
else
   ## other terminal session
fi

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux