Article View: comp.sys.next.misc
Article #759Re: How do I make shell prompt show working directory?
From: Jess Anderson
Date: Tue, 07 Apr 1992 12:06
Date: Tue, 07 Apr 1992 12:06
64 lines
2703 bytes
2703 bytes
In article <1992Apr7.072725.6379@nextdoor.com>
john@nextdoor.com (John McCracken) writes:
>I use /bin/csh as the default shell, and here's what I have
>in my .login file:
>This yields a prompt like:
> nextdoor [/john/Library]-3%
>where "nextdoor" is the host, "/john/Library" is the current
>working directory, and "3" is the command number.
Bearing in mind that this prompt business is (periodically)
a topic more appropriate to comp.unix.questions, here's
another variant:
alias cd 'cd \!*; doprompt'
alias doprompt 'set prompt="[`hostname`:`whoami`]`dirs|sed -e
'\''s/ //'\'' -e 's.~..' -e 's./..'`[\\!] "'
where the doprompt alias is all one line and .cshrc ends with
a doprompt command. A sample result is:
[yak:anderson]Network/Wiscnet/Statistics/Data/RawData[43]
Where I really am at this point is:
/Users/anderson/Network/Wiscnet/Statistics/Data/RawData
One of these days I'll get around to refining this a little, so
as to shorten the prompt by replacing the middle of the path
with an ellipsis ... like this:
[yak:anderson]Network/.../RawData[43]
A further improvement would be to show the front end of the
path when I'm not in my home directory:
[yak:anderson]/NextApps/Installer.app[49]
rather than
[yak:anderson]NextApps/Installer.app[49]
Having both the nostname and the login name is useful to me
because (being a network person), I'm usually on three or
four machines simultaneously (they have similar prompt
settings [just sort-of in the case of the VMS critters]),
and I'm sometimes also running as some other user (notably
root). root's .cshrc adds the usual # in the prompt string
as an *extra* reminder (I'm not bright, though I am
persistent, so I can use more than one reminder :-).
Playing with these things can be a *major* antiproductivity
tool, though nothing I've run into beats Fractint in that
regard.
--
Jess Anderson <> Madison Academic Computing Center <> University of Wisconsin
Internet: anderson@macc.wisc.edu <-best, UUCP:{}!uwvax!macc.wisc.edu!anderson
NeXTmail w/attachments: anderson@yak.macc.wisc.edu Bitnet: anderson@wiscmacc
Room 3130 <> 1210 West Dayton Street / Madison WI 53706 <> Phone 608/262-5888
Technical Details
Message-ID:
<1992Apr7.120605.26841@macc.wisc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!zazen!andersonReferences:
<basiji.702614445@milton> <1992Apr7.072725.6379@nextdoor.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.misc Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!zazen!anderson From: anderson@macc.wisc.edu (Jess Anderson) Subject: Re: How do I make shell prompt show working directory? Message-ID: <1992Apr7.120605.26841@macc.wisc.edu> Sender: news@macc.wisc.edu (USENET News System) Organization: Madison Academic Computing Center, UW-Madison References: <basiji.702614445@milton> <1992Apr7.072725.6379@nextdoor.com> Date: Tue, 7 Apr 92 12:06:05 GMT