Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Apr 2005 20:27:44 -0600
From:      Scott Long <scottl@samsco.org>
To:        Chuck Robey <chuckr@chuckr.org>
Cc:        current <FreeBSD-current@freebsd.org>
Subject:   Re: tcsh
Message-ID:  <42719BA0.5030901@samsco.org>
In-Reply-To: <427196C0.5040506@chuckr.org>
References:  <427196C0.5040506@chuckr.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Chuck Robey wrote:
> The first thing I do, after I've installed a new system (just before I 
> copy over the ssh data) is to copy my .cshrc  to my home dir.  What's so 
> important?  I really like the two statements, which I show below, which 
> give me my prompt:
> 
> set     prompt="%m:%{^[[34m%}`id -nu`%{^[[0m%}:%~:%{^[[31m#%h^[[0m%}%#"
> alias   cd      'cd \!*;set prompt="%m%{^[[32m%}:`id 
> -nu`%{^[[0m%}:%~:%{^[[31m#%h^[[0m%}%#"'
> 
> My mailer is adding carriage returns to the cd line, maybe even to the 
> prompt line, live with it.
> 
> Any chance that something so basic as this, that improves things so 
> awfully much, could be added to the .tcshrc?  If the idea is liked well 
> enough, I will edit it enough so that the special use of prompt strings 
> that are specific to tcsh is made conditional.

Why does 'cd' have to be aliased?  Doesn't 'prompt' act as a magic 
variable that gets re-evaluated every time it's printed?  Anyways,
a less colorful version that I use (can't even remember where I got
it) is:

set prompt = '[%B%m%b] %B%~%b%# '

Has the advantage of changing from a > to a # if you are the superuser,
so it gives approximately the same info as printing the username, but in
less space and without having to spawn a process every time.  For
extra credit, there are variations that change the xterm title bar and
icon, too.

Scott



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