Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 30 Aug 2004 11:11:42 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Christophe DOT Delarue AT reuters DOT com cc: cygwin AT cygwin DOT com Subject: Re: Interpret dos bat file in bash script In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.39 Your problem is not that you can't interpret the batch files ("cmd" will do that just fine), but that you want the changes to the environment made in the batch files to be visible in the calling shell. No interpreter will help you with that. As I said, even with CALLs, you can still use a sed script (albeit not as simple), or it might be easier to write it in perl. Where there's a will, there's a way. FWIW, when you translate the batch files into shell scripts, make sure to use the "source" (or ".") command in place of CALLs, rather than just invoking the scripts, otherwise you'll be back to where you started from. HTH, Igor On Mon, 30 Aug 2004, Christophe.Delarue wrote: > Thanks for your quick answer. > My cmd script use CALL statement, thus it is a little more complex than > a simple sed. > I've hope that somebody has done a little dos command interpreter that > could interpret simple .cmd files > .. I'll translate my cmd files into sh language. > > thanks again > > > On Mon, 30 Aug 2004, Christophe.Delarue wrote: > > > Newbie in window$ ... > > > > I search in doc, web and never find something that can interpret dos > > command like .bat or .cmd files in the cygwin env > > "cmd /c blah.bat" > > > The .bat files I'd like to execute, set env variables required for a > > compilation process > > Is this definitly impossible ? > > Yes. The environment changes made in the batch files won't be visible in > the shell that executed them. If you run something from the batch file > itself, though, you'll see the environment changes. > > > I Only saw it wasn't possible, but do someone did a convertion at > > running time ? > > If all your batch file does are "set"s (and maybe "rem"s), a simple sed > script should produce something that can easily be "eval"ed. If you want > something more complex, you're basically on your own... > 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! "Happiness lies in being privileged to work hard for long hours in doing whatever you think is worth doing." -- Dr. Jubal Harshaw -- 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/