csh is root's shell?

Don Lewis truckman at FreeBSD.org
Thu Oct 7 13:13:39 PDT 2004

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.

More information about the freebsd-current mailing list