public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Why 'script' utility require SHELL (and work fine under  Linux)?
Date: Sun, 16 Oct 2011 17:08:00 -0000	[thread overview]
Message-ID: <j7f316$8hs$1@dough.gmane.org> (raw)
In-Reply-To: <2b5085f5c029ade7accca5dcb86b6f5d@127.0.0.1>

15.10.2011 0:47, Kaz Kylheku пишет:
>
>> So SHELL env var does not exported by bash...
>> Why?
>
> 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".
>
>
> `SHELL'
> The full pathname to the shell is kept in this environment
> variable. If it is not set when the shell starts, Bash assigns to
> 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".
> [...]
> 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
> file.
>
> 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.
>
Thanks for explanation. I set SHELL to /bin/bash under
control panel.

Also I set some another env var (place for info purpose):

   SHELL=/bin/bash
   # Emacs parser of external program output
   # does not expect warnings from Cygwin...
   CYGWIN=nodosfilewarning
   # To allow start X program anywhere when X started,
   # for example by Win+R
   DISPLAY=:0
   # Where live all profiles...
   HOME=e:\home
   # This allow access to info files from Cygwin and native Emacs...
   # Take special attention to final colon.
 
INFOPATH='c:/opt/cygwin/usr/share/info;e:/home/usr/share/info;e:/bin/gnuwin32/info;e:/bin/gnuwin32/share/info:'
   # This allow access to man files from Cygwin and native Emacs
   # (with cygwin-mount.el enabled)...
   # Take special attention to leading colon.
 
MANPATH=:/cygdrive/e/home/usr/share/man:/usr/share/man:/usr/local/share/man

Also 2 year ago I write personal note about why set SHELL to /bin/bash:
if do not do so rxvt use sh as shell and ~/.bashrc was not read
and I lose my personal settings.

But when I switch to mintty I forget about this as mintty start bash by 
default...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2011-10-16 17:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14 21:47 Kaz Kylheku
2011-10-16 17:08 ` Oleksandr Gavenko [this message]
2011-10-17 14:35   ` Andrey Repin
  -- strict thread matches above, loose matches on Subject: below --
2011-10-14  9:44 Oleksandr Gavenko
2011-11-04  5:04 ` Cyrille Lefevre
2011-11-04 20:22   ` David Sastre
2011-11-07 23:23     ` Cyrille Lefevre
2011-11-10  1:20       ` Andrey Repin
2011-11-15 22:45         ` Cyrille Lefevre
2011-11-15 22:52       ` Cyrille Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='j7f316$8hs$1@dough.gmane.org' \
    --to=gavenkoa@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).