1 if [ -n "$_prompt_command_escape" ]; then
2 # Set the title of an xterm to the hostname unless the remote IP is matched by
3 # a regular expression in ~/.ssh/forwarded.
4 SSH_FORWARDED=$(get_remote_ip)
5 if [ ! -z "$SSH_FORWARDED" ]; then
6 if [ "$SSH_FORWARDED" = "localhost" ]; then
8 elif [ -f ${PROFILE_HOME:-~}/.ssh/forwarded ]; then
9 for forwarded in $(< ${PROFILE_HOME:-~}/.ssh/forwarded); do
10 if echo "$SSH_FORWARDED" | grep "$forwarded" &>/dev/null; then
16 [ ! -z "$SSH_FORWARDED" ] && SSH_FORWARDED=" (from $(get_remote_ip -n))"
19 # Unscientific check for grid jobs.
20 case ${SSH_CLIENT##* } in
22 *) SSH_FORWARDED="$SSH_FORWARDED [grid]"
25 info="$HOSTNAME$SSH_FORWARDED"
29 if ps -o comm= -p $PPID 2>/dev/null | grep '^vim*$' &>/dev/null; then
30 # Clear [vim] when exiting.
31 trap "echo -ne '\\033]0;$info\\033\\0134'" exit
34 if [ "${TERM##screen}" = "$TERM" -o "${TERM%%-bce}" = "$TERM" ]; then
35 echo -ne '\033]0;'"$info"'\033\0134\r\033[K'
37 echo -ne "\033k\033\0134"
39 unset blank info vimchild SSH_FORWARDED