cd function

uunet!bria!mike uunet!bria!mike
Mon Feb 18 11:05:54 AEST 1991


In an article, wvus.wciu.edu!pete (Pete Gregory) writes:
>My login shell is /bin/sh (I guess I should say I'm running AT&T V.3.2,
>actually Unisys PTX 1.1.1 for those who care), and I want my prompt
>to include my current working directory.

Well, unless your version of the shell allows a builtin function to be 
superceded, or you have the source (example: BaSH) then you have to resort
to ugliness.

WARNING: Ugliness is to follow.  If you are easily offended by ugly
         kludges to routine problems, do not proceed further.


Take your favorite binary editor (or use adb if you're hard-up), and walk
through the binary for /bin/sh; replace 'cd' with 'xx'.  Then your function
will work ...

	cd() {
		xx $*
		PS1="`pwd`> "
		}

Yep.  I told you it was ugly.

Cheers,
-- 
Michael Stefanik, MGI Inc., Los Angeles| Opinions stated are not even my own.
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
Remember folks: If you can't flame MS-DOS, then what _can_ you flame?



More information about the Comp.unix.questions mailing list