ksh's cd tries to do too much

Chris Bertin chrisb at risky.Convergent.COM
Fri Mar 22 04:13:12 AEST 1991


Ksh does some pre-parsing on the argument to 'cd'. It removes from the
argument all the '..' and the name before the '..' (for optimization, I
guess):

	cd _not_a_directory/../_junk_/..

has no effect, even though 2 directories in the argument don't exist. The
problem is that if you type:

	cd _valid_CDPATH_directory/..

it has no effect either and I think that's a bug.

	$ echo $CDPATH
	:/a/b/c
	$ cd /a/b/c/d
	$ pwd
	/a/b/c/d
	$ cd /
	$ ls d
	d: No such file or directory
	$ cd d/..
	$ pwd
	/

This works with /bin/sh (the shell would put me in /a/b/c) and I didn't find
anything in the man page that would mention this as a 'feature'.

Chris

-- 
Chris Bertin		|   chrisb at risky.Convergent.COM
Unisys			|		or
(408) 435-3762		| ...!uunet!pyramid!ctnews!risky!chrisb



More information about the Comp.unix.shell mailing list