I am trying to get shell variables in the system rc file to be global for all shell scripts. The export command only seems to provide this for scripts run directly from the rc file.
Where/how are the system PATH, SHELL, HOME vars defined, since they are global.
thanks
Didn't find your answer? Ask the community — no account required.
M
Michael Schnell
_Which_ shell do you use ? Is it really "bash" ? How did you configure it ?
-Michael
J
Juergen Beisert
Different shells are reading different files from etc/ and $HOME/ for this purpose. You should run "man
T
tns1
This is 'sh', not bash on a Busybox distro. Does it expect to see a system rc file somewhere?
T
tns1
It looks like I am able to create global vars by exporting them from /etc/profile
T
tns1
Spoke too soon. Global variables created in profile are present only when logged in, so they are useless for autonomous (autolaunch) configurations like mine. I am just looking for a way to define the network settings in one place, yet have them available system-wide.
M
Michael Schnell
What do you mean by "Global variables" ?
What do you mean by "autolaunch" ?
What do you mean by "in one place" ? What do you mean by "system-wide" ?
To provide some information "system-wide" it can be stored in a file and thus is is "in one place".
If multiple shells are started "export" variables only are copied to the shells' environments, if one is spawned by another. Shells also can be spawned by other programs (e.g. init or telnetd) independently from the shell tat interprets the start up script(s) (usually something like "rc").
Some shells look at one or more config file(s) that allow(s) (e.g.) for executing a script before a prompt is shown.
If your shell(s) are used to run scripts, you can simply start each script with "sourcing" (calling) a central standard script (e.g. ". /etc/setvars") ("." means "source": don't spawn another shell).
-Michael
T
tns1
Using the sourcing syntax was what I needed, thanks.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.