Bash prompt string looks for xterm-color, gnome terminal identifies as xterm
Bug #103929 reported by
Steven Harms
This bug affects 18 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash (Ubuntu) |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
Binary package hint: bash
Gnome-terminal, the default ubuntu terminal, supports color. It identifies itself as "xterm". Our skel files looks for "xterm-color". This should be updated to reflect "xterm" instead of "xterm-color".
In /etc/skel/.bashrc please apply the following diff:
--- .bashrc 2007-01-08 12:40:24.000000000 -0500
+++ .bashrc_new 2007-04-06 18:57:17.000000000 -0400
@@ -24,7 +24,7 @@
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
-xterm-color)
+xterm)
PS1=
;;
*)
Related branches
Changed in bash: | |
status: | Unconfirmed → Confirmed |
Changed in bash: | |
assignee: | nobody → micah-cowan |
Changed in bash: | |
status: | Confirmed → In Progress |
Changed in bash: | |
importance: | Undecided → Wishlist |
Changed in bash: | |
status: | Fix Released → Confirmed |
assignee: | doko → nobody |
To post a comment you must log in.
No; that'll kill it for the xterm-color users, then. Could do xterm|xterm- color). ..
Either way, it's a poor way to check for color support; better to check the terminal database. I propose this version:
--- skel.bashrc.orig 2007-04-06 16:37:35.000000000 -0700 chroot= $(cat /etc/debian_chroot)
+++ skel.bashrc 2007-04-06 16:56:16.000000000 -0700
@@ -20,18 +20,19 @@
debian_
fi
-# set a fancy prompt (non-color, unless we know we "want" color) '${debian_ chroot: +($debian_ chroot) }\[\033[ 01;32m\ ]\u@\h\ [\033[00m\ ]:\[\033[ 01;34m\ ]\w\[\033[ 00m\]\$ ' '${debian_ chroot: +($debian_ chroot) }\u@\h: \w\$ ' ${debian_ chroot: +($debian_ chroot) }\[\033[ 01;32m\ ]\u@\h\ [\033[00m\ ]:\[\033[ 01;34m\ ]\w\[\033[ 00m\]\$ '
-case "$TERM" in
-xterm-color)
+# set a fancy prompt (color, when supported)
+
+if tput setaf 1 >&/dev/null
+then
+ # We have color support; assume it's compliant with Ecma-48
+ # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
+ # a case would tend to support setf rather than setaf.)
PS1=
- ;;
-*)
+else
+ # Color apparently unsupported (or don't have tput(!)). Issue
+ # prompt, sans color sequences
PS1=
- ;;
-esac
-
-# Comment in the above and uncomment this below for a color prompt
-#PS1='
+fi
# If this is an xterm set the title to user@host:dir
case "$TERM" in