Created
May 13, 2009 15:48
-
-
Save graywh/111095 to your computer and use it in GitHub Desktop.
gnome-terminal detection to fix $TERM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set $TERM for libvte terminals that set $TERM wrong (like gnome-terminal) | |
{ | |
[ "_$TERM" = "_xterm" ] && type ldd && type grep && type tput && [ -L "/proc/$PPID/exe" ] && { | |
if ldd /proc/$PPID/exe | grep libvte; then | |
if [ "`tput -Tgnome-256color colors`" = "256" ]; then | |
TERM=gnome-256color | |
elif [ "`tput -Txterm-256color colors`" = "256" ]; then | |
TERM=xterm-256color | |
elif tput -T gnome; then | |
TERM=gnome | |
fi | |
fi | |
} | |
} >/dev/null 2>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment