Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!cbosgd!ihnp4!qantel!lll-crg!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.unix,net.unix-wizards Subject: Re: Bourne shell modifications, past and future Message-ID: <156@brl-tgr.ARPA> Date: Thu, 28-Nov-85 20:27:29 EST Article-I.D.: brl-tgr.156 Posted: Thu Nov 28 20:27:29 1985 Date-Received: Sat, 30-Nov-85 00:57:21 EST References: <1943@gatech.CSNET> <10@druri.UUCP> <21@pixdoc.UUCP> Organization: Ballistic Research Lab Lines: 26 Xref: watmath net.unix:6433 net.unix-wizards:15902 > > ....Functions subsume aliases very nicely, so chuck > >aliases! Don't have funny % sequences in prompt strings when `uname` > >or `pwd` will work fine. > > The problem is that PS1="`pwd` " will only evaluate pwd once, and one would > want whatever the directory is now. Same with PS1="$PWD ". Which is why I > use funny % sequences. At least no one else uses them. But you can get this to work nicely if you redefine the "cd" built-in as a shell function (if your shell functions work like 8th Ed. UNIX and not like SVR2). Since I have an SVR2 shell, I can't redefine "cd", so I use "ch" instead. Here `tis: ch(){ # should be cd if [ $# -lt 1 ] then cd # should be built-in cd else cd $1 # ditto fi PS1=`uname | sed s/\^brl-// | tr '[a-z]' '[A-Z]'`:`pwd`'$ ' } Yes, this is a more elaborate PS1, but it makes the point. Berkeley users just have to suffer, but then they are so used to that that they have probably convinced themselves that everything is great. It's nice of you to try to help them out.