Skrevet av Emne: Linux: How to modify my bash prompt  (Lest 4241 ganger)

ATC

  • Gjest
Linux: How to modify my bash prompt
« på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • The bash manpage is quite impossible to read. In addition, trying to google for info on how to modify the shell prompt yields dozens of confusing articles discussing various exotic distros each with their own myriad of init scripts.



    ATC

    • Gjest
    [Solved] Linux: How to modify my bash prompt
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • Add your own PS1 environment variable to your ~/.bash_profile

    Here's the prompt I'm using:

    export PS1="\e[33;1m\tSuSE 10.1 {\j} \h:\w \$ "

    \e[33;1m yields bold green text color (\e[0m would reset this)
    \t yields the current time
    \j yields the current background job count
    \h yields the hostname
    \w yields the pwd
    \$ yields $ for ordinary users and # for root