delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/16/13:08:34

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_40,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_RX,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Oleksandr Gavenko <gavenkoa AT gmail DOT com>
Subject: Re: Why 'script' utility require SHELL (and work fine under Linux)?
Date: Sun, 16 Oct 2011 20:07:42 +0300
Lines: 77
Message-ID: <j7f316$8hs$1@dough.gmane.org>
References: <2b5085f5c029ade7accca5dcb86b6f5d AT 127 DOT 0 DOT 0 DOT 1>
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1
In-Reply-To: <2b5085f5c029ade7accca5dcb86b6f5d@127.0.0.1>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019