X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.profile.d%2Fprompt.bashrc;h=8114b292a9918e9a828bc1bce791894719a0ff27;hb=refs%2Fheads%2Fmaster;hp=ad5b1e3a67ac9342a4abd775804baaaba9d0701d;hpb=4e40b8ea9d367019019e5b0cc39cdb6d65fe3d6e;p=profile.git diff --git a/.profile.d/prompt.bashrc b/.profile.d/prompt.bashrc index ad5b1e3..8114b29 100644 --- a/.profile.d/prompt.bashrc +++ b/.profile.d/prompt.bashrc @@ -1,35 +1,13 @@ -# $Id$ -# -# Set the title of an xterm to the hostname. -# +_prompt_command_escape=1 -SSH_FORWARDED=$(get_remote_ip -n) -if [ ! -z "$SSH_FORWARDED" ]; then - if [ ! "$SSH_FORWARDED" = "62.189.242.202" -a ! "$SSH_FORWARDED" = "62.189.241.202" -a ! "$SSH_FORWARDED" = "193.128.72.68" -a ! "$SSH_FORWARDED" = "localhost" ]; then - SSH_FORWARDED=" (from $SSH_FORWARDED)" - else - SSH_FORWARDED= - fi +# Actual dtterm barfs on escape sequences. +if [ "$TERMINAL_EMULATOR" = "dtterm" ]; then + unset _prompt_command_escape fi -# Unscientific check for grid jobs. -case ${SSH_CLIENT##* } in - ""|22|2222);; - *) SSH_FORWARDED="$SSH_FORWARDED [grid]" -esac - -info="$HOSTNAME$SSH_FORWARDED" - -# Check for vim. -vimchild=" [vim]" -if ps -o comm= -p $PPID 2>/dev/null | grep '^vim*$' &>/dev/null; then - # Clear [vim] when exiting. - trap "echo -ne '\\033]0;$info\\033\\0134'" exit - info="$info$vimchild" +# As does screen on an ancient Solaris host. +if [ -n "$OLDSOLARIS" -a ! "${TERM##screen}" = "$TERM" ]; then + unset _prompt_command_escape fi -if [ "${TERM##screen}" = "$TERM" ]; then - export PROMPT_COMMAND="echo -ne '\033]0;$info\033\0134\r\033[K'" -else - export PROMPT_COMMAND='echo -ne "\033k\033\0134"' -fi -unset blank info vimchild SSH_FORWARDED + +PROMPT_COMMAND='shopt -q nullglob; ng=$?; shopt -s nullglob; for snippet in ${PROFILE_HOME:-~}/.prompt.d/*.prompt; do . $snippet; done; unset snippet; [ $ng = 0 ] || shopt -u nullglob; unset ng'