ECN No Name Newsletter: September, 1992

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

Getting The Path Out Of Your Prompt And Into Your Window

Greg Roslansky & Chris Hubbard

Here ye! Hear ye! If you are the type of person that likes to keep your current path in your prompt, then this article might interest you. A soon-discovered disadvantage of using your absolute pathname as your system prompt is that the deper you go down your directory tree, the longer your prompt becomes, sometimes becoming inconveniently long. When you're using X-windows you can move the path to the title bar area. This allows all of the same information to be available, while using a shorter prompt.

The required magic to perform this feat is as follows. This information should be included in your ".login" file.

#
# Define and set the HOST variable
#
setenv HOST `hostname | sed -e 's/\..*s//'`
#
# Check the TERMinal type.
# Set prompt accordingly
#
if ($term == xterm) then
	set prompt ="HOST> "
	echo -n "^[]l; $HOST^G"
else 
	alias cd 'cd \!*; set prompt="HOST$cwd> "
endif
cd
Note where ^[ indicate control-v control-esc sequence and, ^G indicate control-v control-g sequences.

The "|1" puts the information into the title of the icon, while the "|2" puts the information into the title of the xterm.


webmaster@ecn.purdue.edu
Last modified: Wednesday, 15-Oct-97 16:26:10 EST

[HTML Check] HTML