This is the mail archive of the
mailing list for the Cygwin project.
Re: Why 'script' utility require SHELL (and work fine under Linux)?
- From: Kaz Kylheku <kaz at kylheku dot com>
- To: Oleksandr Gavenko <gavenko at bifit dot com dot ua>
- Cc: <cygwin at cygwin dot com>
- Date: Fri, 14 Oct 2011 14:47:12 -0700
- Subject: Re: Why 'script' utility require SHELL (and work fine under Linux)?
So SHELL env var does not exported by bash...
This is a bug in bash which hides broken behavior
in the OS.
Bash expects this to be an existing environment variable,
and it usually is in normal Unix like operating systems.
However, bash internally sets the variable if it is
missing (without exporting it):
From "info bash".
The full pathname to the shell is kept in this environment
variable. If it is not set when the shell starts, Bash assigns
it the full pathname of the current user's login shell.
It is correct not to export the variable. Bash might not be
the user's shell, so it has no right to introduce itself as
the SHELL to child processes.
But, in fact, the shell does not own that variable at all
and so it should not be setting it up even as an internal
variable. The variable should stay unset to indicate
that "there does not exist a configuration for the user's
shell in this system".
Let's confirm your finding:
linux $ env | grep SHELL
cygwin $ env | grep SHELL
cygwin $ # nothing
Where does it come from on Linux? On the distro I have here,
it is not exported by anything in /etc or my /home directory.
Of course not. It comes from the "login" process which
authenticates you and fetches your shell from the password
Linux man page for "login":
The value for $HOME, $SHELL, $PATH, $LOGNAME, and
$MAIL are set according to the appropriate fields in
the password entry.
Cygwin sets HOME, and PATH, but not SHELL and LOGNAME.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple