This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SHELL env not exported in bash

   When I start the Cygwin bash shell 
with the Cygwin installed procedure
the the SHELL env var is not exported.
(sh started from within bash,
or replacing bash in cygwin.bat,
does not even have a SHELL variable).

The simple program below
can check this:

#include <stdlib.h>

main ()
   char *shellenv;
   shellenv = getenv("SHELL");
   printf ("SHELL is '%s'", shellenv);
   return 0;
<<<<end of testshellenv.c>>>>

gcc -o testshellenv testshellenv.c

If I run ./testshellenv I get:
SHELL is '(null)'
If I enter 
export SHELL
at bash prompt 
./testgetenv returns:
SHELL is '/bin/bash'

Trying the same program on a remote linux machine
gives '/bin/bash' directly, but this is no real
proof as connecting to my local account with ssh
also results in a bash shell where SHELL envvar is exported.

  I can't test on a local Linux machine, sorry.

So my basic question is:
  is it intended behavior that SHELL
env variable is not exported when cygwin bash 
is run locally?

This problem arises from the fact that one of the latest cygwin specific
GDB patch does make use of getenv("SHELL")
and I was rather surprised by the null result that I got here.

Pierre Muller
Institut Charles Sadron
6,rue Boussingault
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]