Xref: utzoo comp.unix.xenix:2522 comp.unix.questions:7713
Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!oberon!bbn!uwmcsd1!marque!uunet!mcvax!ukc!warwick!maujd
From: maujd@warwick.UUCP (Geoff Rimmer)
Newsgroups: comp.unix.xenix,comp.unix.questions
Subject: Re: "cd path" strangeness
Summary: RTFM :-)
Keywords: csh cd
Message-ID: <708@ubu.warwick.UUCP>
Date: 21 Jun 88 12:33:30 GMT
References: <337@vector.UUCP>
Sender: news@warwick.UUCP
Reply-To: maujd@warwick.UUCP (Geoff Rimmer)
Organization: Computer Science, Warwick University, UK
Lines: 43

In article <337@vector.UUCP> chip@vector.UUCP (Chip Rosenthal) writes:
>Here is a wierd one.  In csh, move to some directory which doesn't have
>a "path" subdirectory.  Then type either "cd path" or "chdir path".
>
>The expected response would be "path: No such file or directory."  Instead,
>no message is issued, and either you stay where you were or you move to
>$path[1].  This behavior is independant of the definition of "cdpath" (or
>lack of definition).
>

Let me quote from the manual page for csh!

cd [dir]
chdir [dir]
	Change the shell's working directory to directory dir.  If no
	argument is given, change to the home directory of the user.
	If dir is a relative path-name not found in the current
	directory, check for it in those directories listed in the
	cdpath variable.  If dir is the name of a shell variable whose
	value starts with a /, change to the directory named by that value.

i.e. the argument after the 'cd' or 'chdir' is checked:-

	1	for a directory given by a relative pathname
	2	for a directory in cdpath
	3	for a directory taken from the shell variable

so, since #1,2 fail with your example ('cd path'), #3 is used, and so
the directory is changed to $path[1] - it seems if you give it a
variable that contains more than one directory, such as $path, it
takes the first one.

>-- 
>Chip Rosenthal /// chip@vector.UUCP /// Dallas Semiconductor /// 214-450-0400
>{uunet!warble,sun!texsun!rpp386,killer}!vector!chip
>I won't sing for politicians.  Ain't singing for Spuds.  This note's for you.

	------------------------------------------------------------
	Geoff Rimmer, Computer Science, Warwick University, UK.
			maujd@uk.ac.warwick.opal

	"I report the news as it's seen in my country" - CNN
	------------------------------------------------------------