home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!think.com!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!bruno
- From: bruno@thunder.mcrcim.mcgill.edu (Bruno Hall)
- Subject: Re: Need help putting PWD in PROMPT
- Message-ID: <1992Sep8.210818.23119@thunder.mcrcim.mcgill.edu>
- Organization: McGill University Broom Closet
- References: <1992Sep8.152514.24851@orlith.bates.edu>
- Date: Tue, 8 Sep 92 21:08:18 GMT
- Lines: 27
-
- pbeach@abacus.bates.edu (Preston Beach) writes:
-
- > I want to get my prompt to give my current working directory all the time.
- >I need this for an Ultrix and BSD system. If anyone knows of a script or
- >shell file which will do this please send it my way. Thanks very much.
- > -Preston
- >p.s. I am using csh. btw
-
- Tsk. You should be using tcsh, which has this feature built in. :-) :-)
-
- Here's what I use (and it's not dependent on tcsh):
-
- set hnm = `hostname | sed 's/\..*//'`
- if $?prompt then
- alias cd 'set old=$cwd; chdir \!*; dirs; resetprompt'
- alias pushd 'pushd \!* ; resetprompt'
- alias popd 'popd \!* ; resetprompt'
- alias resetprompt 'if "$cwd:q" == "/" set prompt = "${hnm}:[/] >"; if "$cwd:q" != "/" set prompt = "${hnm}:[$cwd:t] > "'
- resetprompt
- endif
-
- Plus, you get to use this:
-
- alias back 'set whereto=$old; set old=$cwd; cd $whereto; unset whereto'
-
- Bruno
- --
- /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
- Bruno Hall | VE2HUM | bruno@mcrcim.mcgill.edu
- McGill Research Centre for Intelligent Machines - Controls Group
- New systems generate new problems -- Join the Flat Earth Society.
-