delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/31/07:24:45

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4D946471.40006@dronecode.org.uk>
Date: Thu, 31 Mar 2011 12:24:33 +0100
From: Jon TURNEY <jon DOT turney AT dronecode DOT org DOT uk>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Updated base-files-4.0-6
References: <announce DOT 20110318184505 DOT GG10633 AT jethro DOT local DOT lan> <4D93C294 DOT 1090509 AT laposte DOT net> <4D93C4B7 DOT 1070505 AT laposte DOT net>
In-Reply-To: <4D93C4B7.1070505@laposte.net>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

On 31/03/2011 01:03, Cyrille Lefevre wrote:
> Le 31/03/2011 01:53, Cyrille Lefevre a écrit :
>> Le 18/03/2011 19:45, David Sastre a écrit :
>>> Version 4.0-6 of base-files has been uploaded.
>>>
>>> Base-files is a set of system configuration and setup files.
> 
> Hi,
> 
> PS1 *must not* be exported.
> 
> historically, it is not exported to know if it is a shell is interactive or
> not since only interactive shells set it.
> 
> i.e., the following both solutions are equivalent.
> 
> case $- in *i*) interactive ;; esac
> [ -n $PS1 ] && interactive
> 
> if PS1 is exported, it is always set for subshells and this may cause trouble
> in some script.
> 
> also, from man bash :
> 
> An  interactive  shell  is one started without non-option arguments and
> without the -c option whose standard input and error are both connected
> to  terminals  (as determined by isatty(3)), or one started with the -i
> option.  PS1 is set and $- includes i if bash is interactive,  allowing
> a shell script or a startup file to test this state.

What the man page doesn't tell you is that bash actually unsets PS1 if the
shell isn't interactive, so for bash at least, exporting PS1 can't cause a
problem.

--
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