Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!sbcs!eeserv1.ic.sunysb.edu!jallen From: jallen@eeserv1.ic.sunysb.edu (Joseph Allen) Newsgroups: comp.unix.xenix.sco Subject: Re: Printing Working Directory in CSH (or SH for that matter) Message-ID: <1991May4.194839.14190@sbcs.sunysb.edu> Date: 4 May 91 19:48:39 GMT References: <46@swatty.UUCP> <112@comix.UUCP> <1991May1.001454.9035@nshore.ncoast.org> Sender: usenet@sbcs.sunysb.edu (Usenet poster) Distribution: usa Organization: State University of New York at Stony Brook Lines: 44 In article <1991May1.001454.9035@nshore.ncoast.org> steve@nshore.ncoast.org (Stephen J. Walick) writes: >As quoted from <112@comix.UUCP> by jeffl@comix.UUCP (Jeff Liebermann): >[how do you make 'sh' show current path whenever you "cd"] All you have to do is replace all occurances of 'cd' in the shell program with some new name. I used my editor to do this, but most editors can't handle ascii files so I made a simple program to do it. The new name for the command I picked is 'ce'. Originally I tried 'Cd' but that didn't work. I think either it doesn't like the command being in uppercase, or the commands are sorted. 'ce' is in the same sort position as 'cd' and it works. 1) compile this program to 'a.out' main() { int c; while(-1!=(c=getchar())) if(c!='c') putchar(c); else { c=getchar(); if(c=='d') putchar('c'), putchar('e'); else putchar('c'), putchar(c); } } 2) Now run the program and make a new shell (it would not be a good idea to replace sh) cat /bin/sh | a.out >/bin/jsh chmod a+x /bin/jsh (jsh for Joe's shell, of course :-) 3) now change your shell to the new shell in the password file and put this in your .profile cd () { ce $*; PS1=`pwd`">"; } cd -- /* jallen@ic.sunysb.edu */ /* Amazing */ /* Joe Allen 129.49.12.74 */ int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0) +r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2 ]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}