CD doesn't work in script

Dave Korn dave.korn@artimi.com
Thu May 3 16:24:00 GMT 2007


On 03 May 2007 17:18, SCHLING wrote:

> Hi all,
> 
> I have successfully installed Cygwin on XP SP2, and would like to run a
> script which includes a change directory command (cd \etc.)
> 
> All the other lines of the script work except the one with cd. The same line
> works when input by hand.
> 
> Searching on the net I found that line endings could be critical (Lf instead
> of CrLf) and ran the script through d2u. Still no success.
> 
> Curiously, if the script tries a cd with a non-existing directory, I get a
> warning. Otherwise, the script runs withouth any problems, but the active
> directory does not change.
> 
> Don't know what to do next...

  How about showing us the actual code you're trying to execute, and telling
us the actual error that happens.  "Doesn't work" gives us no clue at all -
for all we can tell, the problem could be anything from the power being off to
a missing shell....

  However, I can see one possibility: if what you wrote is actually "cd \etc",
the way you have it above, you've got the wrong kind of slashes.  Backslashes
escape special characters, forward slashes are dir separators, so "cd /etc"
means change into the 'etc' subdir in the root directory, and "cd \etc" means
cd into the 'etc' subdir of whereever you are right now, because the "\" just
means to treat the next char (i.e. 'e') literally...



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list