This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "cd" in bash script not being executed

Sorry, it was my understanding of scripting that was broken. My script wasn't permanently changing directories so I thought "cd" wasn't working. But amazingly enough you actually can't permanently change directories in a script without a workaround... you have to "source" the script instead of execute it, or something along those lines... the reason being that scripts execute as child processes and can't change the directory of their parent process. See this thread:

That thread has a very interesting discussion of "cd" and even a suggestion on how to get rid of the need to type the command altogether, by the way.

So anyway, cygwin is working fine... well just like Unix and how it's supposed to in any case... which is fine.

Aaron Stephanic

Robert Menschel wrote:
Hello Aaron,

Friday, September 10, 2004, 8:43:36 PM, you wrote to the Cygwin list:

AS> I'm having the same problem as in this thread:

AS> "cd" in bash scripts is not working. Is this a bug?

They're working here. I've had no problem with "cd" in my bash scripts
under Cygwin, none at all in the four months I've been using Cygwin.

So the problem isn't with "cd", but with some specific combination of
things. People on the list will need to know more about what you're doing
in order to help.

Bob Menschel

-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]