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/
      |\      _,,,---,,_                [EMAIL PROTECTED]
ZZZzz /,`.-'`'    -.  ;-;;,_            [EMAIL PROTECTED]
     |,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/

Reply via email to