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:
http://archive.lug.boulder.co.us/bymonth/1998.12/msg00151.html


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> http://www.cygwin.com/ml/cygwin/2004-07/msg00197.html

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: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


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