delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/03/09:35:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Mon, 3 May 2004 09:35:21 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Jan Schormann <Jan DOT Schormann AT BrainLAB DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Handling of /etc/profile.d broken?
In-Reply-To: <KCEOLMMHICICJKHPFOALAEDGCDAA.Jan.Schormann@BrainLAB.com>
Message-ID: <Pine.GSO.4.56.0405030930130.9982@slinky.cs.nyu.edu>
References: <KCEOLMMHICICJKHPFOALAEDGCDAA DOT Jan DOT Schormann AT BrainLAB DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Mon, 3 May 2004, Jan Schormann wrote:

> Hi,
>
> I've just noticed a weird problem:
> When I set an environment variable in a script in
> /etc/profile.d, I never see it in my shell.
> For example, take
>
> ---- /etc/profile.d/blub.sh:
> export blub=1
> ----
>
> Adding "echo $blub" to the loop in /etc/profile,
> I can see that it gets set, but is unset immediately
> after the loop.
>
> The attached patch changes the loop from the
> "find ... | while ..." idiom to "for f in `find ...` ...",
> and that works.
>
> Is it true that the "|" starts a new sub-shell, which
> makes all the "export" commands and the use of the
> "source" (".") obsolete? What a pity.
>
> I wonder whether it has been like that all the time,
> and I'm the only one who's so stupid as to try and set
> environment variables in /etc/profile.d?
>
> Funny world ;-) Any hints?
>
> Best wishes,
>         Jan.

You have an old version of /etc/profile.  The base-files package will not
replace /etc/profile if it exists, even if it wasn't modified (that's the
way setup's postinstall scripts work, as there is currently no easy way of
detecting user modifications -- <http://cygwin.com/acronyms/#PTC>).  If
you didn't modify yours and want to switch to the latest version (which
has the above problem fixed, BTW), simply copy /etc/defaults/etc/profile
over /etc/profile (or delete /etc/profile and reinstall the base-files
package).

BTW, yes, it's true, '|' always starts a new subshell...  However,
different shells have differing ideas on which part of the pipe chain
executes in the *current* shell.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

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

- Raw text -


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