"cd path" strangeness
Geoff Rimmer
maujd at warwick.UUCP
Tue Jun 21 22:33:30 AEST 1988
In article <337 at vector.UUCP> chip at 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 at 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 at uk.ac.warwick.opal
"I report the news as it's seen in my country" - CNN
------------------------------------------------------------
More information about the Comp.unix.questions
mailing list