#!/bin/sh case X"$TERM" in #Xxterm) #handle most reasonable xterm variations and PuTTY's vt100 emulation Xxterm|Xxterm[-+]*|Xvt100) #try to determine how to get echo to do octal escape sequences and #to handle supression of newline echo_e= echo_c= echo_n= x=`echo '\056'` if [ X. != X"$x" ]; then x=`2>>/dev/null echo -e '\056'` if [ X. = X"$x" ]; then echo_e=-e else 1>&2 echo "$0: don't know how to do octal escape sequences with echo" exit 1 fi fi echo $echo_e '' | read x || { 1>&2 echo "$0: echo $echo_e '' | read x fails!" exit 1 } echo $echo_e '\c' | read x if [ $? -ne 0 ]; then echo_c='\c' else 2>>/dev/null echo $echo_e -n '' | read x if [ $? -ne 0 ]; then echo_n=-n else { 1>&2 echo "$0: don't know how to do supress newline with echo" exit 1 } fi fi #do the actual work :-) echo $echo_e $echo_n "\033];${@-$TERM}\007$echo_c" ;; esac