SUMMARY: Exporting variables

From: Spalding, Steve <SSPALDIN_at_mem-ins.com>
Date: Wed, 22 Apr 1998 14:21:27 -0500

My original message is:

"Hi managers!

> I let my users set up what ever they want in .profile in their home
> directories, except for one line which I use to execute a side shell
> script which is supposed to set specific aliases and variables which
> all
> users should have. I don't put these aliases and variables in
> /etc/profile because different users will be logging into different
> environments, and I use /etc/profile for EVERY user. The problem is
> that
> even though these aliases and variables are being set when the script
> executes while the user is logging in, they are not set once the user
> gets to the shell.
>
> I've tried putting these aliases and variables in .kshrc in the users'
> home directories, but that still did not work. If I put the aliases
> and
> variables in /etc/profile, they are set when the user logs on;
> however,
> if I set the aliases and variables from a shell script executed in
> /etc/profile, the aliases and variables are not set.
>
> Can anyone explain to me what's going on here? Why is it that if I
> execute a shell script from .profile or /etc/profile which sets
> aliases
> and variables, they are not set once the user is logged all the way
> on.
>
> Thanks!"
>
>
The answer to this question is to "source" my shell script instead of
trying to execute it, and the way to do this in ksh is by using the "."
command (in csh you would actually use "source" as the command). For
example, in my .profile if I wanted to run a shell script called
profile_extra which sets variables and aliases, my line for doing so
would look like this:
. profile_extra

Thanks to all those who responded!

-StephenS
Received on Wed Apr 22 1998 - 21:27:13 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT