delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/26/16:13:05

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:from:date:message-id:subject:to :content-type:x-gm-message-state; bh=YozwoRegN/PMY3WRkRpTZeXuFURl7zOXscmx+1gO2ZE=; b=Rl+6WWF5pISYhCMaguHwZhJ2F7Am8Dp1iMhX3Zi1UqJbHM7NZnloxTJeFLPFmVwy05 JKQuYb1rHGxc5CXX7cVeQnJPdfSih9ODl/UORSN4nAAMDaWzOmizbxMQGkIW5Ra7Plkj vo1Kyd/h3cjKKN9vdij+FgHLi2uEKhuQI9C8PVX1OE6OP3cOCUjuWjJqQSD+QGYvtPAs gukALz7tp0Y6/DE2Ng/QWZsGEA5LfpLGAb9Pcd+796eVECcFar1y5HJQAE+wVAAWc7oZ aGt+TyUx4q64lt/DINqWD6fKbZCIPcziRzDTC4Ma9jYTQPUTzZr0W0WMRrZ2OUP6vAAP KaxA==
MIME-Version: 1.0
From: David Caldwell <david AT davidpcaldwell DOT com>
Date: Mon, 26 Mar 2012 21:12:11 +0100
Message-ID: <CAJ2SvnmS15ZciHfB_=Ddog-Bdc5-pf+fVuOb0uJ7a=oX81SDhA@mail.gmail.com>
Subject: Re: Proposed change to base-files /etc/bash.bashrc: see whether PS1 has already been set
To: cygwin <cygwin AT cygwin DOT com>
X-Gm-Message-State: ALoCoQkDLcxjhJi4J0Jv5ChM4g8cAne7aaPdA5xDjvcWFj3O8/3RQOU2i5j1jIBx8YITvsDOGf0z
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 Mon, Mar 26 2012 at 09:22:3147PM +0200, David Sastre Medina wrote:
>>On Mon, Mar 26, 2012 at 04:40:31PM +0100, David Caldwell wrote:
>> I can't figure out where the CVS is for base-files, but I wanted to
>> propose that the file:
>>
>> /etc/bash.bashrc
>>
>> ... be altered to test whether the PS1 variable has already been set
>> before setting it to the default.
>> I set mine in a file in the?/etc/profile.d?directory, but with the
>> standard Cygwin installation, this value is overwritten unless I
>> modify each user's local setup or alter the system-wide file.
>> It would be harmless to ignore already-set values in this situation.
>> I could obviously generate a patch as necessary if I knew where the
>> repository was, but it's a one-liner, basically:
>>
>> if [ -z "$PS1" ]; then
>> ? ? ? ? PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
>> fi

>There is no public repository for the package. That does not stop you
>from generating a patch, though :)

>You forgot to say which shell are you using, as they are/can be
>differently set up WRT PS1.

>If I wanted all my users to get a custom (read: different from the
>default) PS1, I guess I'd use the skel files for that.

>If you decide to use a custom /etc/profile.d/ script to do that job,
>then you need to tweak system-wide /etc/profile as well, IMHO.

>Also, the patch is indeed harmless, but, as you provide it, i needs to
>be used once for each ifdef in the profile.

I'm not sure I follow ... I'm not a UNIX system administration expert,
but I am pretty sure the bash.bashrc file pertains only to bash. And
the current base version of that file only sets one variable: PS1. So
that's why I'm proposing the one-line patch.

I'm not sure why one would need to alter /etc/profile to create an
/etc/profile.d script, but I'm open to hearing more.

Of the various shells referenced in the provided /etc/profile, only
bash executes a custom file (in addition to executing the files in
/etc/profile.d), and it executes /etc/bash.bashrc.

I suppose an alternative, equivalent change to the one I originally
proposed might be to execute /etc/bash.bashrc *before* executing the
files in /etc/profile.d; either makes sense to me. I'm not sure what
the precedence order of those ought to be but my view is bash.bashrc
ought to be executed first as it is providing out-of-the-box defaults
and /etc/profile.d is intended for local modification.

I'd be willing to generate either patch. :)

-- David.

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