Skip to content

Instantly share code, notes, and snippets.

@graywh
Created May 13, 2009 15:48
Show Gist options
  • Save graywh/111095 to your computer and use it in GitHub Desktop.
Save graywh/111095 to your computer and use it in GitHub Desktop.
gnome-terminal detection to fix $TERM
# 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