Does anyone know how to invoke a bash process via a dos batch program so commands after bash execute?

Igor Pechtchanski pechtcha@cs.nyu.edu
Tue Apr 13 18:32:00 GMT 2004


On Mon, 12 Apr 2004, Lipin, Adam wrote:

> Does anyone know how to invoke a bash process via a dos batch program so
> commands after bash execute?
>
> For example.
> batch1.bat contains:
>
> REM This is batch1.bat
> batch2.bat test
> exit
>
>
> batch2.bat contains:
>
> REM this is batch2.bat
> echo %1
> bash
> echo %1
> exit
>
>
> The result set is:
> test
>
> I want it to be:
> test
> test

Try "exit"ing from the bash process... :-)  When you start an interactive
bash process, it doesn't return until you leave it.  You can verify that
you're in a different bash process by changing the prompt via "PS1='$ '"
and then observing that the new bash sets the prompt to the default value.

FWIW, the following works:

batch2.bat contains:

@echo off
echo %1
bash -c "echo $BASH_VERSION"
echo %1
exit

The result:

$ ./batch2.bat test
test
2.05b.0(1)-release
test

The batch file called from a batch file is a red herring, as others
mentioned.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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