public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrew DeFaria <Andrew.DeFaria@tellabs.com>
To: cygwin@cygwin.com
Subject: Re: Does not work well: rlwrap + rxvt + cmd
Date: Thu, 25 Aug 2011 17:46:00 -0000	[thread overview]
Message-ID: <j361od$vsq$1@dough.gmane.org> (raw)
In-Reply-To: <1314258683.16270.140258133521969@webmail.messagingengine.com>

On 8/25/2011 12:51 AM, Ronald Fischer wrote:
> On Wed, 24 Aug 2011 11:56 -0400, "Eliot Moss"<moss@cs.umass.edu>  wrote:
>> On 8/24/2011 11:52 AM, Ronald of Steiermark wrote:
>>> On Wed, 24 Aug 2011 08:39 -0700, "Andrew DeFaria"<Andrew@DeFaria.com>
>>> 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 <Windows path>

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
<verify output>
$ # That worked!
$ cmd /c testscript2.bat
<verify output>
$ # 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 <posix path> or whatever.
-- 
Andrew DeFaria <http://defaria.com>
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

  reply	other threads:[~2011-08-25 17:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 15:07 Ronald Fischer
2011-08-24 15:15 ` Eliot Moss
2011-08-25  7:34   ` Ronald Fischer
2011-08-24 15:16 ` Charles Wilson
2011-08-24 15:40 ` Andrew DeFaria
2011-08-24 15:52   ` Ronald of Steiermark
2011-08-24 15:56     ` Eliot Moss
2011-08-25  7:51       ` Ronald Fischer
2011-08-25 17:46         ` Andrew DeFaria [this message]
2011-08-24 16:04     ` Andrew DeFaria
2011-08-25  7:54       ` Ronald of Steiermark
2011-08-25 17:37         ` Andrew DeFaria

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='j361od$vsq$1@dough.gmane.org' \
    --to=andrew.defaria@tellabs.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).