From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20269 invoked by alias); 25 Aug 2011 17:46:22 -0000 Received: (qmail 20257 invoked by uid 22791); 25 Aug 2011 17:46:21 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_RX,TW_YG X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Aug 2011 17:46:06 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qwe0B-0006YF-6k for cygwin@cygwin.com; Thu, 25 Aug 2011 19:46:03 +0200 Received: from 173-164-195-49-sfba.hfc.comcastbusiness.net ([173.164.195.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Aug 2011 19:46:03 +0200 Received: from Andrew.DeFaria by 173-164-195-49-sfba.hfc.comcastbusiness.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Aug 2011 19:46:03 +0200 To: cygwin@cygwin.com From: Andrew DeFaria Subject: Re: Does not work well: rlwrap + rxvt + cmd Date: Thu, 25 Aug 2011 17:46:00 -0000 Message-ID: References: <1314198447.17029.140258133233741@webmail.messagingengine.com> <1314201141.31858.140258133254297@webmail.messagingengine.com> <4E551F18.4020402@cs.umass.edu> <1314258683.16270.140258133521969@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: <1314258683.16270.140258133521969@webmail.messagingengine.com> X-Stationery: 0.7.5 X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-08/txt/msg00479.txt.bz2 On 8/25/2011 12:51 AM, Ronald Fischer wrote: > On Wed, 24 Aug 2011 11:56 -0400, "Eliot Moss" wrote: >> On 8/24/2011 11:52 AM, Ronald of Steiermark wrote: >>> On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria" >>> wrote: >>> For instance, to test the cruel BAT files which we are going to deliver. >> You can run .bat files from bash and other Cygwin shells. > You can *run* them, but the effect is not always the same. > > For example, setting an environment variable within a batch file under > CMD.EXE results in the environment variable being visible in the calling > environment (similar to "sourcing" a file in bash), while calling the > batch file from bash leaves the environment intact. This behavior is well known. However why does it matter? Are you saying that you have to "source" a .bat file to set up the environment and then execute another .bat file that requires those environment settings??? I'm not saying this doesn't happen but it's not a very good practice. > Also, some internal commands (for example COPY) are not present in bash, > though this can be easily remedied using an alias or a shell function. Why should this be an issue? I mean if you exec some .bat file and it calls "copy" does it not work? > Other problems are related to the use of \ as a path separator. Imagine > that some of your BATCH files generate environment variables containing > a Windows path, Again, why is this a problem? If your .bat file has "copy C:\Windows\some.dll C:\Temp" does it not work? Or are you saying that you may need to do from bash: $ some.bat If this is there are a lot of solutions including cygpath, doubling backslashes, quoting file names or just using forward slashes (which Windows often works just fine with). > and simply because bash command lines are interpreted differently than > Windows CMD command line (for example, when it comes to quoting or > parameter substitution). We all know that bash interprets things the bash way. And no doubt cmd interprets things it's way. I do not see cmd's interpretation as superior. > The main problem, however, is: If you are going to deliver something, > which is supposed to run under CMD.EXE, most customers won't accept it > until you really have tested it under CMD.EXE, and for good reason. That's where: $ cmd /c somescript.bat comes in. That does run it under cmd.exe doesn't it? Why do you need anything more? Why do you need to enter multiple commands and have command history? Why not simply: $ cmd /c testscript1.bat $ # That worked! $ cmd /c testscript2.bat $ # That worked too... $ # etc... > In fact, even though I got running rxvt with cmd thanks to all the > suggestions to my post, I will do some *final* tests still in plain, > native Windoze Command-Windows, just for the safe side. > > Using a bash shell as a "main work horse" is great, but when you have > the pleasure to create and test batch files, you will sooner or later be > happy to also have a CMD shell available... Just re-write your .bat scripts in Perl! ;-) > >> In both cases you generally to present Windows paths, of course; >> cygpath can help with that. > I use cygpath in several of my scripts and it's extremely useful, but > dealing with the various path representations in interactive work is, > for me at least, an annoyance... It's really not that hard. Just s/\\/\/g! That often is enough. Or do a cygpath -w or whatever. -- Andrew DeFaria My wife keeps complaining I never listen to her ...or something like that. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple