[opensuse] Handling Environment Variables
SuSE 10.0 I've just added a utility to my SuSE installation which was built from scratch rather than an RPM. Consequently, it has put itself into the /opt directory. In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session. How can I add these two paths permanently for all users? TIA John --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local. This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users. Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andreas Hanke wrote:
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local.
This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users.
Indeed.
e.g.:
- ---8<----------------------------------------------
PATH=/opt/app/bin:$PATH
MANPATH=/opt/app/man:$MANPATH
export PATH MANPATH
- ---8<----------------------------------------------
An alternative notation (but bash specific):
- ---8<----------------------------------------------
export PATH=/opt/app/bin:$PATH
export MANPATH=/opt/app/man:$MANPATH
- ---8<----------------------------------------------
Though there's normally no need to export them, as they have already
been marked as exported in /etc/profile, so this should be sufficient:
- ---8<----------------------------------------------
PATH=/opt/app/bin:$PATH
MANPATH=/opt/app/man:$MANPATH
- ---8<----------------------------------------------
But better mark them as export again, just to make sure ;)
Anyhow, another option is to put it as a separate file under
/etc/profile.d/ with a filename that ends in ".sh"
Basically, what /etc/profile does:
- - looks for /etc/profile.local - if it exists, it sources it
- - looks for files as /etc/profile.d/*.sh - and sources those that are
readable
The interesting thing with /etc/profile.d/*.sh is that you can select
what users will get the stuff that's in there through user/group and
access rights.
e.g. if you want some variables/exports/functions/aliases to only be
defined for a certain group of people, you can:
- - create a group for them (groupadd or in yast), e.g. "staff"
- - put those people in that group
- - create e.g. /etc/profile.d/staff-functions.sh
- - put the export/function/alias definitions in there (e.g. the PATH and
MANPATH stuff as above)
- - chown root:staff /etc/profile.d/staff-functions.sh
- - chmod 0040 /etc/profile.d/staff-functions.sh
cheers
- --
-o) Pascal Bleser http://linux01.gwdg.de/~pbleser/
/\\
Pascal Bleser wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Andreas Hanke wrote:
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local.
This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users.
Indeed. e.g.: - ---8<---------------------------------------------- PATH=/opt/app/bin:$PATH MANPATH=/opt/app/man:$MANPATH export PATH MANPATH - ---8<----------------------------------------------
An alternative notation (but bash specific): - ---8<---------------------------------------------- export PATH=/opt/app/bin:$PATH export MANPATH=/opt/app/man:$MANPATH - ---8<----------------------------------------------
Though there's normally no need to export them, as they have already been marked as exported in /etc/profile, so this should be sufficient: - ---8<---------------------------------------------- PATH=/opt/app/bin:$PATH MANPATH=/opt/app/man:$MANPATH - ---8<----------------------------------------------
But better mark them as export again, just to make sure ;)
Anyhow, another option is to put it as a separate file under /etc/profile.d/ with a filename that ends in ".sh"
Basically, what /etc/profile does: - - looks for /etc/profile.local - if it exists, it sources it - - looks for files as /etc/profile.d/*.sh - and sources those that are readable
The interesting thing with /etc/profile.d/*.sh is that you can select what users will get the stuff that's in there through user/group and access rights. e.g. if you want some variables/exports/functions/aliases to only be defined for a certain group of people, you can: - - create a group for them (groupadd or in yast), e.g. "staff" - - put those people in that group - - create e.g. /etc/profile.d/staff-functions.sh - - put the export/function/alias definitions in there (e.g. the PATH and MANPATH stuff as above) - - chown root:staff /etc/profile.d/staff-functions.sh - - chmod 0040 /etc/profile.d/staff-functions.sh
cheers - -- -o) Pascal Bleser http://linux01.gwdg.de/~pbleser/ /\\
_\_v The more things change, the more they stay insane. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFFVaNZr3NMWliFcXcRAmFIAKCxUGMbF4cAxSsHb22wpRqAzVxXDQCggI23 HeLXCsWqUw9rdMQOy09pI+U= =wzKX -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Thanks for your help; I chose to follow Python's example and put a .sh file into profiles.d J --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Andreas Hanke wrote:
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local.
This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users.
Assuming he's using bash, what's the difference between that and bash.bashrc.local? --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sunday 12 November 2006 15:08, James Knott wrote:
Andreas Hanke wrote:
John schrieb:
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
Use /etc/profile.local.
This file does not exist in a default installation. Just create it, write your stuff into this file and it will be picked up for all subsequent logins of all users.
Assuming he's using bash, what's the difference between that and bash.bashrc.local?
Nothing, really. /etc/profile sources bash.bashrc when it runs, for bash specific settings --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Saturday 2006-11-11 at 09:52 -0000, John wrote:
I've just added a utility to my SuSE installation which was built from scratch rather than an RPM. Consequently, it has put itself into the /opt directory.
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
The easiest way is to put locally made/compiled programs under /usr/local. The normal environment is prepared to use that tree by default. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFFVfHVtTMYHG2NR9URAt4lAJ0Vfmj2CplGnbn1L82i8v86qjN7qACfYibB yhU0dsC8bpB02WKAmajNfew= =h0uP -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
John wrote:
SuSE 10.0
I've just added a utility to my SuSE installation which was built from scratch rather than an RPM. Consequently, it has put itself into the /opt directory.
In order to run this app and read its manual, I need to add the relevant directories to PATH and MANPATH respectively, but if I use the 'export' command, it only adds them or the current session.
How can I add these two paths permanently for all users?
From /etc/bash.bashrc
# /etc/bash.bashrc for SuSE Linux # # PLEASE DO NOT CHANGE /etc/bash.bashrc There are chances that your changes # will be lost during system upgrades. Instead use /etc/bash.bashrc.local # for your local settings, favourite global aliases, VISUAL and EDITOR # variables, etc ... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Anders Johansson
-
Andreas Hanke
-
Carlos E. R.
-
James Knott
-
John
-
Pascal Bleser