delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/04/13/14:33:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 13 Apr 2004 14:32:49 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: "Lipin, Adam" <Adam DOT Lipin AT morganstanley DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Does anyone know how to invoke a bash process via a dos batch program so commands after bash execute?
In-Reply-To: <E6292146029E2943934457D3F16DA44A383794@bkexch112.msdwis.com>
Message-ID: <Pine.GSO.4.56.0404131427590.26068@slinky.cs.nyu.edu>
References: <E6292146029E2943934457D3F16DA44A383794 AT bkexch112 DOT msdwis DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

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 AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT 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/

- Raw text -


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