delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/07/17/23:43:39

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 17 Jul 2008 23:42:47 -0400
From: Ken Jackson <cygwin AT jackson DOT io>
Subject: Re: How to run a bash shell script from cygwin console
In-reply-to: <4cee11bc0807171433l2e42ae87j3f2fdc9bb1ee7101@mail.gmail.com>
To: cygwin AT cygwin DOT com
Message-id: <18560.4407.978377.399817@intel.local>
MIME-version: 1.0
X-Mailer: emacs 22.1.1 (via feedmail 8 I); VM 7.19 under Emacs 22.1.1
References: <18515908 DOT post AT talk DOT nabble DOT com> <487F9BCB DOT 8010806 AT sbcglobal DOT net> <18516861 DOT post AT talk DOT nabble DOT com> <20080717202137 DOT GA891 AT ednor DOT casa DOT cgf DOT cx> <18517222 DOT post AT talk DOT nabble DOT com> <18517238 DOT post AT talk DOT nabble DOT com> <4cee11bc0807171433l2e42ae87j3f2fdc9bb1ee7101 AT mail DOT gmail DOT com>
X-IsSubscribed: yes
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

Sam Hanes writes:
 > akarui wrote:
 > >
 > > Here from the output, I see that "cd", "pwd" and "ls" worked fine. But the
 > > console prompt is not yet changed, means, "cd" didn't permanently changed
 > > the directory, 'cause I get "pwd" as below:
 > > /****************
 > > $ pwd
 > > /cygdrive/d
 > > ****************/
 > >
 > > Note that, I like to have the console's prompt changed to "/soapui", where
 > > I'll run a program named "testrunner.bat" later.
 > >
 > 
 > BASH runs scripts in a sub-shell, and changes made to the environment
 > in the sub-shell do not propagate to the parent shell. To run a script
 > in the current shell so it can change your environment, call it as `.
 > yourscript` instead of just `yourscript`. AFAIK there's nothing that
 > you can put in the script to make it do this all the time.

True, but you can combine a script and an alias to give you the
effect.

Maybe put runRWS.sh in ~/bin/ and then add this alias to
~/.bash_profile or ~/.bashrc:

alias runRWS=". ~/bin/runRWS.sh"

Then the command runRWS will work as you expect.

-Ken Jackson

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