delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/03/12:25:18

X-Spam-Check-By: sourceware.org
Date: Thu, 3 May 2007 12:24:52 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: SCHLING <schling AT mail DOT telepac DOT pt>
cc: cygwin AT cygwin DOT com
Subject: Re: CD doesn't work in script
In-Reply-To: <10307440.post@talk.nabble.com>
Message-ID: <Pine.GSO.4.63.0705031222120.12789@access1.cims.nyu.edu>
References: <10307440 DOT post AT talk DOT nabble DOT com>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Thu, 3 May 2007, 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...

The first thing to do is to try the same script on Linux -- I suspect this
is not a Cygwin-specific problem.

One WAG is that the cd does happen, but in a subprocess (e.g.,
parenthesized command, or part of a pipe), so that the main bash process
does not see the change in directory.  If that is the case, see a bash
scripting guide for possible fixes (this is the same problem as setting
environment variables in subprocesses).  Again, this is not
Cygwin-specific.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019