delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/03/01:21:16

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <470326A8.38F75848@dessent.net>
Date: Tue, 02 Oct 2007 22:20:40 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: newbie question -- problem with launching shell script files
References: <92af9b620710022153u1d56488erbc58010cc56ad9ef AT mail DOT gmail DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

Alexey Illarionov wrote:

> I wrote a small script. Here is the content of the 'run.sh'
> 
> #!/bin/sh
> cd /cygdrive/c
> 
> Unfortunately, it does not work. The command './run.sh' does nothing.

Let's back up a moment.  What do you expect the above script to actually
do?  Nothing is the proper and expected behavior -- there is no way for
a child process to change the CWD of the parent so if you are expecting
the CWD to be different after running the script then you have a
misunderstanding of how scripting works.  If you want to affect things
like the CWD or environment of the current process, you can't do it by
invoking a child, you must source the contents of the script in the
current process.

Brian

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