How to run a bash shell script from cygwin console

Ken Jackson cygwin@jackson.io
Fri Jul 18 03:43:00 GMT 2008


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/



More information about the Cygwin mailing list