Incomplete environ when running MinGW apps?

Greg Chicares
Thu Feb 7 17:52:00 GMT 2008

On 2008-02-07 16:28Z, Paul Leder wrote:
> [...] I've written an app which runs on Linux and 
> "Windows". Most of the time on "Windows", it's probably going to be 
> running on Cygwin/bash. However, there's always going to be someone who 
> runs it in a DOS box.
> So, my problem is, how do I find out if they've got a sane shell or not? 
> I can't ask them to export SHELL; I might as well just ask them to 
> provide a command-line arg to tell me what their shell is anyway. I need 
> some automatic way to do it.

cat >what_shell.c <<\EOF
#include <stdio.h>
#include <stdlib.h>

int main()
  int z;
  z = system("uname");
  printf("%d\n", z);
  return z;

gcc -mno-cygwin -o what_shell.exe -W -Wall -pedantic -ansi what_shell.c

Cygwin bash output:

$ ./what_shell

CMD.EXE output:

'uname' is not recognized as an internal or external command,
operable program or batch file.

Of course, that'll report a sane shell even in CMD.EXE if
Cygwin's /bin is on $PATH, but IIRC that might be what you
want: for example, it'll tell you whether you can run 'ls'
or have to fall back on 'dir'.

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list