delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/16/07:36:43

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <29725859.post@talk.nabble.com>
References: <29720777 DOT post AT talk DOT nabble DOT com> <4C9122C1 DOT 7040902 AT towo DOT net> <29725859 DOT post AT talk DOT nabble DOT com>
Date: Thu, 16 Sep 2010 12:36:16 +0100
Message-ID: <AANLkTinv-OE+7OXphjjuHmeohncV2cMpAWPtsu-f7r7W@mail.gmail.com>
Subject: Re: Security Warning: Re: Behaviours of Terminal Versus Script when using "<<"
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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

On 16 September 2010 08:59, delbydev wrote:
> The issue is the cmd shell does not handle the inheritance of variables from
> the shell to a script without making explicit call within the script to bind
> the variables

Can you provide simple instructions that demonstrate the issue without
requiring a database? By "cmd shell", do you mean Cygwin bash running
in a console window, or do you mean the actual Windows command
processor (the one that prompts with 'C:\Users\name>').


> The mintty terminal handles this fine as per Typical true bash environments
> on UNIX servers
> - the cmd shell seems to require another configuration to enable variables
> to be inherited in a script from the outer shell - this I don't presently
> know how

That sounds a bit confused. Let me try to clarify things a bit.

Cmd.exe and the console window are not the same thing. Cmd.exe is a
command processor, similar in concept (if not implementation) to Unix
shells such as bash. They all just take text input and produce text
output and they don't concern themselves with displaying a window or
anything like that.

When you invoke a console application such as cmd.exe or bash.exe from
Explorer, Windows automatically creates a console window for it that
turns key presses into text input and that display text output on the
screen. On Windows 7, that's implemented by conhost.exe.

Meanwhile, mintty is similar to conhost.exe in that it sends keyboard
input to the program running inside it and displays output coming back
from the program. You can set the program to run in it on the mintty
command line. By default, that's bash, i.e. no matter whether you
invoke the "Cygwin Bash Shell" or the "mintty" shortcut, it's normally
bash that's processing your commands.

To summarise:

Console/terminal: conhost, mintty, rxvt, xterm ...
Command processor/shell: cmd, bash, tcsh, zsh, ...

There are important differences between Windows consoles and Unix
terminals as well, but let's leave those for now ...

Andy

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

- Raw text -


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