Enviromental Vars

Enviromental Vars

Post by Patrick McDonnel » Wed, 02 Apr 2003 10:53:26



Hi - Sorry to bother everyone with such a trivial question.  There are a
handful of enviromental variables that I need to set for all users.  Most I
was able to add to ~/.bashrc files.  However, some I want the users (who
aren't that cmd line savvy) to be able to edit.  I thought about adding
scripts to the /usr/bin directory, which looked like this:

# cat /usr/bin/lincds

#!/bin/bash
export LINDA_CLC=cds
export LINDA_FLC=cds

--

# cat /usr/bin/linnet

#!/bin/bash
export LINDA_CLC=network
export LINDA_FLC=network

The scripts run, but upon examination of the output of the env and export
commands, it doesn't look like the variables have 'stuck'.  I known that
this should be a pretty simple matter, and any help would be appreciated.  
Thanks!

 
 
 

Enviromental Vars

Post by Paul Kimot » Thu, 03 Apr 2003 06:36:57



>  There are a
> handful of enviromental variables that I need to set for all users.  Most I
> was able to add to ~/.bashrc files.  However, some I want the users (who
> aren't that cmd line savvy) to be able to edit.

(This sounds somewhat contradictory ...)

Quote:>  I thought about adding
> scripts to the /usr/bin directory, which looked like this:

> # cat /usr/bin/lincds

> #!/bin/bash
> export LINDA_CLC=cds
> export LINDA_FLC=cds

This does not (seem to) work because executing these files (in the shell)
means running them as child subprocesses, and children cannot change their
parents' environment.  You need to run the specified commands (which affect
the current shell) in the shell directly (just as though they were typed in
manually), which can be done with

$ . /path/to/file/with/list/of/shell/commands

or

$ source /path/to/file/with/list/of/shell/commands

--
Paul Kimoto
This message was originally posted on Usenet in plain text.  Any images,
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.

 
 
 

Enviromental Vars

Post by Patrick McDonnel » Sat, 05 Apr 2003 10:29:50




>>  There are a
>> handful of enviromental variables that I need to set for all users.  Most
>> I
>> was able to add to ~/.bashrc files.  However, some I want the users (who
>> aren't that cmd line savvy) to be able to edit.

> (This sounds somewhat contradictory ...)

>>  I thought about adding
>> scripts to the /usr/bin directory, which looked like this:

>> # cat /usr/bin/lincds

>> #!/bin/bash
>> export LINDA_CLC=cds
>> export LINDA_FLC=cds

> This does not (seem to) work because executing these files (in the shell)
> means running them as child subprocesses, and children cannot change their
> parents' environment.  You need to run the specified commands (which
> affect the current shell) in the shell directly (just as though they were
> typed in manually), which can be done with

> $ . /path/to/file/with/list/of/shell/commands

> or

> $ source /path/to/file/with/list/of/shell/commands

That works, but I'd like to be able to allow the users to execute one
command, such as 'linnet' or 'lincds'.  Is this possible.  I tried make a
bash script in /usr/bin that runs 'source /path/to/export/commands' but
that didn't work.
 
 
 

Enviromental Vars

Post by Paul Kimot » Sat, 05 Apr 2003 14:47:26





>> $ . /path/to/file/with/list/of/shell/commands

>> or

>> $ source /path/to/file/with/list/of/shell/commands
> That works, but I'd like to be able to allow the users to execute one
> command, such as 'linnet' or 'lincds'.  Is this possible.

Make up a bash alias (or shell function) with the value of
". /path/to/file/with/list/of/shell/commands"
or even
"first_shell_command; second_shell_command"
and put that in the appropriate bash startup file(s).  Of course, this
will work only in bash, after the right startup file is found.

Quote:> I tried make a
> bash script in /usr/bin that runs 'source /path/to/export/commands' but
> that didn't work.

... for *exactly the same reasons* as enumerated before.

--
Paul Kimoto
This message was originally posted on Usenet in plain text.  Any images,
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.

 
 
 

Enviromental Vars

Post by Patrick McDonnel » Sat, 05 Apr 2003 21:31:26






>>> $ . /path/to/file/with/list/of/shell/commands

>>> or

>>> $ source /path/to/file/with/list/of/shell/commands

>> That works, but I'd like to be able to allow the users to execute one
>> command, such as 'linnet' or 'lincds'.  Is this possible.

> Make up a bash alias (or shell function) with the value of
> ". /path/to/file/with/list/of/shell/commands"
> or even
> "first_shell_command; second_shell_command"
> and put that in the appropriate bash startup file(s).  Of course, this
> will work only in bash, after the right startup file is found.

>> I tried make a
>> bash script in /usr/bin that runs 'source /path/to/export/commands' but
>> that didn't work.

> ... for *exactly the same reasons* as enumerated before.

OK.  Thanks for you help.
 
 
 

1. Enviromental vars?

Hi,

I've gotten my mouse to work in just about everything.
However, I here one may see the mouse in the Console, which I don't.
And there are a few games that do NOT support my mouse.
These games complain of un-found environmental variables.

Any ideas on what I can change?
Thanks In Advance.

--Sean

2. Having problems whlie updating and running RedHat Linux 5.2

3. Q setting enviromental var in Parent Proces

4. Netscape "bus error" - huh?

5. sh var -> awk var -> sh var

6. TURN 6$ INTO THOUSANDS

7. $Display enviromental variable

8. Asynchronous I/O with ioctl.

9. exporting enviromental variables.

10. KSH and X -- enviromental variables

11. How to set the enviromental varialbles for a CGI script?

12. ? re setting enviromental varible LPDEST

13. How large can /var/log/messages and /var/log/syslog get ?