Subject: Re: Why 'script' utility require SHELL (and work fine under Linux)?
From: David Sastre <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Fri, 4 Nov 2011 21:22:13 +0100
List-Id: <cygwin.cygwin.com>

On Fri, Nov 04, 2011 at 06:05:39AM +0100, Cyrille Lefevre wrote:
> the base-file maintainer has been BCC'ed to add the export SHELL to
> the /etc/profile.

GNU/Linux login sets SHELL to bash, mksh, ... whilst ssh sets SHELL to
/bin/bash, /bin/posh, /bin/mksh ...
Given that there is no real login into cygwin (yet?), SHELL should be
set to the expected login value.

Assuming SHELL would be set and exported for login shells, i.e.,
further (nested) callings to interactive, non-login shells would
inherit the original (login) SHELL value (as in GNU/Linux):

$ echo $SHELL
bash
$ mksh
$ echo $SHELL
bash

It could be fixed for bash, zsh, and mksh. Even for nested
calls to login shells (which GNU/Linux doesn't honor) by setting SHELL 
for every ifdef in /etc/profile. Collateral damage:

-posh works OK if set as login shell in /etc/passwd, but it is broken 
when called from command line as login shell (i.e. it ignores both 
/etc/profile and ~/.profile)
-sh thinks she's bash:
 
$ bash -l
$ echo $SHELL
bash
$ mksh -l
$ echo $SHELL
mksh
$ sh -l
$ echo $SHELL
bash
$ posh -l
$ echo $SHELL
bash

In short: it's not clear to me how to add this functionality
consistently.

-- 
Huella de clave primaria: AD8F BDC0 5A2C FD5F A179  60E7 F79B AB04 5299 EC56