Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Reply-To: cygwin AT cygwin DOT com To: Jan Schormann cc: cygwin AT cygwin DOT com Subject: Re: Handling of /etc/profile.d broken? In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: 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 -- ). 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/