Security Warning: Re: Behaviours of Terminal Versus Script when using "<<"

Andy Koppe
Thu Sep 16 16:41:00 GMT 2010

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


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list