| delorie.com/archives/browse.cgi | search |
| 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 |
| Reply-To: | <Jan DOT Schormann AT BrainLAB DOT com> |
| From: | "Jan Schormann" <Jan DOT Schormann AT BrainLAB DOT com> |
| To: | <cygwin AT cygwin DOT com> |
| Subject: | Handling of /etc/profile.d broken? |
| Date: | Mon, 3 May 2004 10:18:44 +0200 |
| Message-ID: | <KCEOLMMHICICJKHPFOALAEDGCDAA.Jan.Schormann@BrainLAB.com> |
| MIME-Version: | 1.0 |
| X-OriginalArrivalTime: | 03 May 2004 08:18:44.0729 (UTC) FILETIME=[40488690:01C430E7] |
| X-Spam-Status: | No, hits=-104.8 required=5.5 tests=BAYES_10,MSGID_GOOD_EXCHANGE,USER_IN_WHITELIST version=2.55 |
| X-Spam-Level: | |
| X-Spam-Checker-Version: | SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) |
| X-IsSubscribed: | yes |
| Note-from-DJ: | This may be spam |
------=_NextPart_000_0011_01C430F8.03BA2510
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
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.
------=_NextPart_000_0011_01C430F8.03BA2510
Content-Type: application/octet-stream;
name="profile.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="profile.patch"
--- /etc/profile~ 2003-09-02 11:14:35.695367000 +0200
+++ /etc/profile 2004-05-03 10:08:17.905875000 +0200
@@ -47,7 +47,7 @@
=20
# Run all of the profile.d scripts
# Note that these are supplied by separate packages
-/bin/find /etc/profile.d -iname '*.sh' -type f | while read f; do
+for f in `/bin/find /etc/profile.d -iname '*.sh' -type f`; do
if [ -f "$f" ]; then
. "$f"
fi
------=_NextPart_000_0011_01C430F8.03BA2510
Content-Type: text/plain; charset=us-ascii
--
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/
------=_NextPart_000_0011_01C430F8.03BA2510--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |