Subject: Re: Setting prompt...
To: None <port-mac68k@netbsd.org>
From: Space Case <wormey@eskimo.com>
List: port-mac68k
Date: 10/08/1998 19:13:25
On Oct 8, 11:50am, Colin Wood wrote:
>Jude Giampaolo wrote:
>> Chris Jewell carved on a block of stone:
>> >    How do you set the prompt for the c-shell in the .cshrc to show your
>> > current path.  I tried what I thought would work but it doesn't.
>> Here's what I use:
>> set prompt="%m%~ %h%%> "
>i believe the above only works with tcsh (which i'd recommend using over
>standard csh).  most solutions for tcsh look something like:
>alias reprompt	'set prompt=`pwd`"%'
>alias cd 	'cd;reprompt'

This is what I use.  It tries to bold the host name, taking into account
shell (csh and tcsh use different semantics for bold) and terminal type.
It also prints only the last two elements of the path, so your prompt
doesn't end up starting way over on the right side of the screen if you
happen to be deep in some directory structure.

The ^[ characters in the second alias are ESC's, entered in vi as ^v ^[

if ($TERM == "vt200" || $TERM == "vt220" || $TERM == "xterm") then
  if ($SHELL == "/bin/tcsh") then
    alias setp 'set hwd=$cwd:h; set prompt = "<\! %B`hostname`%b /$hwd:t/$cwd:t># "'
  else
    alias setp 'set hwd=$cwd:h; set prompt = "<\! ^[[1m`hostname`^[[0m /$hwd:t/$cwd:t># "'
  endif
else
  alias setp 'set hwd=$cwd:h; set prompt = "<\! `hostname` /$hwd:t/$cwd:t># "'
endif
setp

alias cd 'cd \!*; setp'
alias pushd 'pushd \!*; setp'
alias popd 'popd \!*; setp'


HTH,
~Steve

-- 
Steve Allen - wormey@eskimo.com   http://www.eskimo.com/~wormey/   ICQ 6709819

Faith is the quality that enables you to eat blackberry jam on a picnic
without looking to see whether the seeds move.

Contrary to popular belief, Unix is user friendly.  
It just happens to be selective about who it makes friends with.
	-Kyle Hearn  <kyle@intex.net>

Furbling, v.:
	Having to wander through a maze of ropes at an airport or bank
even when you are the only person in line.
		-- Rich Hall, "Sniglets"