Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 36799 Details for
Bug 26952
PS1
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
diff PS1 based on colour, root, and remote
advanced-PS1.patch (text/plain), 1.48 KB, created by
Luke-Jr
on 2004-08-05 00:43:02 UTC
(
hide
)
Description:
diff PS1 based on colour, root, and remote
Filename:
MIME Type:
Creator:
Luke-Jr
Created:
2004-08-05 00:43:02 UTC
Size:
1.48 KB
patch
obsolete
>--- /tmp/bashrc 2004-08-05 07:22:47.918289456 +0000 >+++ /etc/bash/bashrc 2004-08-05 07:36:43.830211528 +0000 >@@ -15,9 +15,36 @@ > fi > > # Set colorful PS1 only on colorful terminals >-if dircolors --print-database | grep -Fqx "TERM $TERM"; then >- PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' >+isroot=$([[ "$EUID" = 0 || "`/bin/whoami`" = 'root' ]] && echo 1) >+iscolour=$(dircolors --print-database | grep -Fx "TERM $TERM") >+isremote="${SSH_CONNECTION}" >+if [ "$iscolour" == "" ]; then >+ if [ "$isroot" == "1" ]; then >+ if [ "$isremote" == "" ]; then # colourless root local >+ PS1='\h \W \$ ' >+ else # colourless root remote >+ PS1='!\h! \W \$ ' >+ fi >+ else >+ if [ "$isremote" == "" ]; then # colourless non-root local >+ PS1='\u@\h \W \$ ' >+ else >+ PS1='\u@!\h! \W \$ ' >+ fi >+ fi > else >- PS1='\u@\h \W \$ ' >+ if [ "$isroot" == "1" ]; then >+ if [ "$isremote" == "" ]; then # colour root local >+ PS1='\[\033[1;31m\]\h \[\033[01;34m\]\W \$ \[\033[0;33;1m\]' >+ else # colour root remote >+ PS1='\[\033[1;33;41m\]!\[\033[0;1;31;4m\]\h\[\033[0;1;33;41m\]!\[\033[0m\] \[\033[01;34m\]\W \$ \[\033[0;33;1m\]' >+ fi >+ else >+ if [ "$isremote" == "" ]; then # colour non-root local >+ PS1='\[\033[01;32m\]\u\[\033[35m\]@\[\033[32m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]' >+ else # colour non-root remote >+ PS1='\[\033[01;32m\]\u\[\033[35m\]@\[\033[1;33;41m\]!\[\033[0;1;32;4m\]\h\[\033[0;1;33;41m\]!\[\033[0m\] \[\033[1;34m\]\W \$ \[\033[0m\]' >+ fi >+ fi > fi > export PS1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 26952
:
16391
|
16392
|
16393
| 36799