Article View: comp.sys.next.misc
Article #789Re: How do I make shell prompt show working directory?
From: Christopher Maeda
Date: Tue, 07 Apr 1992 14:54
Date: Tue, 07 Apr 1992 14:54
38 lines
2016 bytes
2016 bytes
In article <1992Apr7.120605.26841@macc.wisc.edu> anderson@macc.wisc.edu (Jess Anderson) writes: > >In article <1992Apr7.072725.6379@nextdoor.com> >john@nextdoor.com (John McCracken) writes: > >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./..'`[\\!] "' > That's disgusting. Why do people think firing up sed with line noise for arguments every time you change your working directory is elegant? "Many small tools..." "Thousand points of light..." You also have to alias pushd and popd. Another solution to this problem is to use tcsh or bash which both let you put the working directory in the prompt by saying something simple like (this works for bash) PS1="\h \w : " "\h" is replaced with the host name. "\w" is replaced with the working directory. This gives the following prompt: MC8 ~/News : It also updates it automatically when the working directory changes. -- Chris Maeda, Grad Student and RetroGrouch <cmaeda@cs.cmu.edu> "A unix signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who."
Technical Details
Message-ID:
<1992Apr07.145433.53171@cs.cmu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!ukma!psuvax1!rutgers!rochester!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!cmaedaReferences:
<basiji.702614445@milton> <1992Apr7.072725.6379@nextdoor.com> <1992Apr7.120605.26841@macc.wisc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!ukma!psuvax1!rutgers!rochester!cantaloupe.srv.cs.cmu.edu!crabapple.srv.cs.cmu.edu!cmaeda From: cmaeda+@cs.cmu.edu (Christopher Maeda) Newsgroups: comp.sys.next.misc Subject: Re: How do I make shell prompt show working directory? Message-ID: <1992Apr07.145433.53171@cs.cmu.edu> Date: 7 Apr 92 14:54:33 GMT References: <basiji.702614445@milton> <1992Apr7.072725.6379@nextdoor.com> <1992Apr7.120605.26841@macc.wisc.edu> Organization: School of Computer Science, Carnegie Mellon Lines: 38 Nntp-Posting-Host: mc8.mach.cs.cmu.edu