Re: more distinct default bash prompt?

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

 



Once upon a time, Richard W.M. Jones <rjones@xxxxxxxxxx> said:
> FWIW Haiku uses bash and has a prompt which changes colour (green/red)
> depending on whether the status code of the last command was good or
> bad.  I found this surprisingly useful.  They use:
> 
> \[`if [ $? = 0 ]; then echo "\e[32m"; else echo "\e[31m"; fi`\]\w[\e[0m\]>

I've used something similar in my prompt for a while, making it bold if
the last command failed.  I do it with:

    # get "normal" and "emphasis" terminal entries
    prompt_term[0]=$(tput sgr0)
    prompt_term[1]=$(tput bold)

    # make the prompt bold if the last command failed
    PS1='\[${prompt_term[$(($??1:0))]}\]'"$PS1"'\[${prompt_term[0]}\]'

I will say though that getting into how the prompt looks can be highly
personalized bike-shedding. :)  I haven't used the default Red Hat or
Fedora prompt basically ever IIRC (and I started with Red Hat with RHL
3.0.3, long before RHEL or Fedora).

-- 
Chris Adams <linux@xxxxxxxxxxx>
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux