Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting Global environment variables

23 views
Skip to first unread message

g_dalby

unread,
Nov 8, 1999, 3:00:00 AM11/8/99
to
How can I make variable definitions global in QNX4 other than during
login via the profile and .profile files. I have several projects and
would like to redefine variables such as HOME without logging in as a
different user. I can simply execute: export HOME=/xxx within a shell
command file but the definition is lost once the file completes.

Any help appreciated.


Sent via Deja.com http://www.deja.com/
Before you buy.

Mike Taillon

unread,
Nov 8, 1999, 3:00:00 AM11/8/99
to
On Mon, 08 Nov 1999 17:16:48 GMT g_dalby (gra...@dalby.fsnet.co.uk) wrote:
> How can I make variable definitions global in QNX4 other than during
> login via the profile and .profile files. I have several projects and
> would like to redefine variables such as HOME without logging in as a
> different user. I can simply execute: export HOME=/xxx within a shell
> command file but the definition is lost once the file completes.

this is expected. environment variables get inherited from parent
to child.

> Any help appreciated.


instead of starting a new sh to execute your shell command file,
execute it with the current shell.

eg.
. cmd.sh

instead of
cmd.sh


note that the #!/bin/sh will be treated as a comment with .


> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
Mike Taillon Quitters never win, Winners never quit.
QNX Software Systems, Ltd. But those who neither win nor quit are idiots.

g_dalby

unread,
Nov 9, 1999, 3:00:00 AM11/9/99
to
In article <807a44$gk$1...@gateway.qnx.com>,
> Thanks Mike - Problem Solved

Nick Costescu

unread,
Nov 11, 1999, 3:00:00 AM11/11/99
to g_dalby
Graham,
The appropriate place to do this in /etc/profile. For example, if you put

export QRTS=/usr/qrts
in /etc/profile, then all users will see this $QRTS env variable.

Remember you need to log completely out (not just quit a shell) when you
modify /etc/profile because it only executes when you log in.

Hope this helps,
Nick


g_dalby wrote:

> How can I make variable definitions global in QNX4 other than during
> login via the profile and .profile files. I have several projects and
> would like to redefine variables such as HOME without logging in as a
> different user. I can simply execute: export HOME=/xxx within a shell
> command file but the definition is lost once the file completes.
>

> Any help appreciated.


>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--

****************************************************
Quality Real-Time Systems
Tel: 864 656 7708 / Fax: 864 624 9155
http://www.qrts.com

Terje Trane

unread,
Nov 12, 1999, 3:00:00 AM11/12/99
to
Nick Costescu wrote in message <382AE867...@qrts.com>...

>Graham,
>The appropriate place to do this in /etc/profile. For example, if you put
>
>export QRTS=/usr/qrts
>in /etc/profile, then all users will see this $QRTS env variable.
>
>Remember you need to log completely out (not just quit a shell) when you
>modify /etc/profile because it only executes when you log in.

...or you can set the ENV variable in sysinit to point to the profile.
Put "export ENV=/etc/profile" before you run tinit.
Then everytime a new shell is opened profile will be read.


Sam Roberts

unread,
Nov 12, 1999, 3:00:00 AM11/12/99
to

You can do the export E=... in a command file, just don't execute
the file as a script, source it:

. my_new_environment_variables.sh

This will evaluate the statements in the file in the context of your
current shell, so will have lasting effect.

Sam

Previously, Nick Costescu wrote in comp.os.qnx:


> Graham,
> The appropriate place to do this in /etc/profile. For example, if you put
>
> export QRTS=/usr/qrts
> in /etc/profile, then all users will see this $QRTS env variable.
>
> Remember you need to log completely out (not just quit a shell) when you
> modify /etc/profile because it only executes when you log in.
>

> Hope this helps,
> Nick
>
>
> g_dalby wrote:
>
> > How can I make variable definitions global in QNX4 other than during
> > login via the profile and .profile files. I have several projects and
> > would like to redefine variables such as HOME without logging in as a
> > different user. I can simply execute: export HOME=/xxx within a shell
> > command file but the definition is lost once the file completes.
> >
> > Any help appreciated.
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> --
>
> ****************************************************
> Quality Real-Time Systems
> Tel: 864 656 7708 / Fax: 864 624 9155
> http://www.qrts.com
>
>
>

--
--
Sam Roberts (s...@cogent.ca), Cogent Real-Time Systems (www.cogent.ca)
"News is very popular among its readers." - RFC 977 (NNTP)


0 new messages