X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.3 required=5.0	tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Achim Gratz <Stromeko@nexgo.de>
Subject: Re: /etc/profile
Date: Tue, 21 Aug 2012 17:56:51 +0200
Lines: 35
Message-ID: <87393g8cho.fsf@Rainer.invalid>
References: <loom.20120821T114938-389@post.gmane.org>	<50337A02.8070809@redhat.com> <loom.20120821T153030-47@post.gmane.org>	<5033AAB8.8010705@redhat.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Eric Blake writes:
> Sorry, POSIX requires that to leave LC_ALL set after the function
> call,

Interesting.  Where is that specified?

> which is not what you want (bash behaves differently according to
> whether it was started as bash or sh).

OK, it wasn't the same as the original invocation anyway since now the
scripts would be called with LC_ALL=C set (which might be exactly what
you wanted, but still...) — so perhaps:

profile_d ()
{
  _LC_SAVE_="$LC_ALL"
  LC_ALL=C
  for file in /etc/profile.d/*.$1 ; do
    [ -e "${file}" ] && LC_ALL="$_LC_SAVE_" . "${file}"
  done
  LC_ALL="$_LC_SAVE_"
  unset file
  unset _LC_SAVE_
}

That leaves the original function calls the same as well.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds


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

