Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!usc!apple!sun-barr!rutgers!dptg!att!cbnewsc!sft From: sft@cbnewsc.ATT.COM (scott.thompson) Newsgroups: comp.bugs.sys5 Subject: Re: ksh bug on function aliasing Message-ID: <2958@cbnewsc.ATT.COM> Date: 6 Sep 89 17:19:51 GMT References: <776@tuminfo1.lan.informatik.tu-muenchen.dbp.de> Organization: AT&T Bell Laboratories Lines: 28 From article <776@tuminfo1.lan.informatik.tu-muenchen.dbp.de>, by schmauss@lan.informatik.tu-muenchen.dbp.de (Oin): > Here is a bug I've found in ksh @(#)Version 06/03/86. > I declared a function chdir() for the shell builtin cd and > aliased cd to be chdir() ( see script below for details ). > Now have a look at the following two different behaviours of ksh: > ... example deleted ... > This is not a bug, as a matter of fact it is documented; aliases are expanded at the time of function DEFINITION. By the way ksh will expand the $PWD environment variable in PS1 automagically, no need for the function. I believe this is supported in the version you are using, just postpone the evaluation of the appropriate variable, namely $PWD: PS1="\${PWD} ! \$ " PS2="\${PWD} >>> " Also, you don't need to unalias cd within the chdir function, just place it in single quotes. ie: 'cd' $* -- Scott Thompson (IH 6W-207), AT&T Bell Labs, Naperville, Il. 60566 VOICE: (312)-979-2237 UUCP: ...!att!ihlpa!sft