Xref: utzoo comp.unix.xenix:2487 comp.unix.questions:7636 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!fxgrp!ljz From: ljz@fxgrp.UUCP (Lloyd Zusman) Newsgroups: comp.unix.xenix,comp.unix.questions Subject: Re: "cd path" strangeness Keywords: csh cd xenix sysv Message-ID: <701@fxgrp.UUCP> Date: 16 Jun 88 20:16:36 GMT References: <337@vector.UUCP> <922@.UUCP> Reply-To: ljz%fx.com@ames.arc.nasa.gov (Lloyd Zusman) Organization: Master Byte Software, Los Gatos, California Lines: 45 In article <922@.UUCP> jbush@ficc.UUCP (james bush) writes: 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". > ... This is even more wierd. I tried it on our Intel Xenix system, and it worked as you said when I did it under my login. However, when I tried to show it to my friend under his id, it came up with the "expected" error message! I am not sure what the difference is. The wierd behavior described by Mr. Rosenthal is due to a little known feature of the C shell: If a shell variable is set to a value whose first character is a "/", it can be used with cd without the leading dollar sign. For example, suppose you have done the following: set foo = /a/b/c/d/e Then, the next two lines will have the exact same behavior: cd $foo cd foo Here's the description in our csh man page: cd [dir] chdir [dir] Change the shell's working directory to directory dir. ... ... If dir is the name of a shell variable whose value starts with a /, change to the direc- tory named by that value. Note that this works only with shell variables, not environment variables. The wierd behavior described by Mr. Bush might be due to the fact that his 'path' variable's first entry begins with a "/", while his friend's 'path' variable doesn't. -- Lloyd Zusman UUCP: ...!ames!fxgrp!ljz Master Byte Software Internet: ljz%fx.com@ames.arc.nasa.gov Los Gatos, California or try: fxgrp!ljz@ames.arc.nasa.gov "We take things well in hand."