?: tcsh escape for retitling cmdtool

Rich Kaul kaul at icarus.eng.ohio-state.edu
Sat Aug 4 05:11:33 AEST 1990


In article <616 at exodus.Eng.Sun.COM> holtz at strawdog.Eng.Sun.COM (Brian Holtz) writes:
   The following alias (for retitling a cmdtool or shelltool) works in csh
   but hangs tcsh when the alias is invoked:

   alias label 'echo -n "^[]l\!*^[\"'

It's reasonably easy.  I mentioned this bug (or difference from Sun's
csh handling of the escape sequences) to Paul Placeway some time ago.
The solution is to drop something at the end of the command.  Here's
what I placed in my .cshrc for use with tcsh (I have since switched to
bash, but that's another story).

# 
# Prompting information.
#
if ($?DISPLAY) then		# X Windows Prompt
	alias cwdcmd 'echo -n "^[]0;"{$HOST}":$cwd^G"'
	echo -n "^[]0;"{$HOST}":$cwd^G"
	set prompt="%h> "
	if ($?uid) then
	    if ($uid == 0) set prompt="%S%t>%s "
	endif
# Suntools Prompting
else if ($?WINDOW_PARENT || ($TERM == "sun" && `tty` != "/dev/console")) then
	alias cwdcmd 'echo -n "^[]l"{$HOST}": $cwd^[\^A"'
	echo -n ^[\]l"$HOST": $cwd^[\\
	set prompt="%h> "
	if ($?uid) then
	    if ($uid == 0) set prompt="%S%t>%s "
	endif
else				# Everything else
	set prompt={$HOST}":%~> "
	if ($?uid) then
	    if ($uid == 0) set prompt={$HOST}":%S%/>%s "
	endif
endif
-- 
Rich Kaul                         | "Do not do unto others as you would that
kaul at icarus.eng.ohio-state.edu    |  they should do unto you.  Their tastes
or ...!osu-cis!kaul		  |  may differ."  -Bernard Shaw



More information about the Comp.unix.questions mailing list