Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Oct 2004 13:13:25 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        jhb@FreeBSD.org
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: csh is root's shell?
Message-ID:  <200410072013.i97KDPoH059493@gw.catspoiler.org>
In-Reply-To: <200410071415.45063.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On  7 Oct, John Baldwin wrote:
> On Thursday 07 October 2004 12:44 pm, Don Lewis wrote:

>> This is what I use:
>>
>>         set prompt = '%m:%c4 %h%#'
>>         if ($?TERM && $TERM == xterm) then
>>                 set prompt='%{\033]0;%n@%m:%c5\007%}%m:%c %h%#'
>>         endif
>>
>> It adds the last few components of $cwd and the history event number to
>> the prompt.  When running in an xterm, it puts the username, hostname,
>> and the last part of $cwd in the xterm title.
> 
> You can use the precmd alias for that.  Here's my .tcshrc.interactive file 
> that I use for interactive sessions:

> set prompt="\n[%B%P%b] (%l) %B%n@%m%b:%.03\n%# "

> if (($term =~ xterm*) || ($term == eterm)) then
> 	alias precmd 'echo -n "]2;${USER}@${HOST}:$cwd"'
> 	# XXX - stupid tcsh processes this for subshells!
> 	#alias jobcmd 'echo -n "]2;${USER}@${HOST}:$cwd - \!#"'
> 	#cwdcmd
> endif

I don't see any advantage to using precmd for this at least one
disadvantage -  with precmd, you can't use %c# to limit the length of
the path printed in the title.  It looks like cwdcmd would be a useful
optimization if there was some way to handle exiting or suspending a
remote shell session.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410072013.i97KDPoH059493>