Eg: LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib myprog As an alternative, I would suggest finding some way to prepend the LD_LIBRARY_PATH to the start of the command line for each program that needs it before running. Note also though that setting LD_LIBRARY_PATH permanently is potentially problematic, including being a security risk. check your distro documentation or look at the /etc/profile script to see how these files are loaded. sh (although does not need a bang line or executable permissions since it is sourced). On Debian, the file must have the extension. Same goes for a file under /etc/profile.d, there also may be naming restrictions which must be met for the file to work. In /etc/profile, you must use export since this is a script, eg: export ORACLE_HOME=/usr/lib/oracle/11.2/client64 In /etc/environment, variables are usually set with name=value, eg: ORACLE_HOME=/usr/lib/oracle/11.2/client64 Creating a new file in /etc/profile.d may be preferable if it exists, as it will be less likely to conflict with updates made by the packaging system. To do if for all users/shells, depending on distro you could use /etc/environment or /etc/profile. You could place your sh script with all you exported variables here.īe carefull though this should not be use as a standard way of adding variable to env on Debian. If you need to add system wide environment variable, there's now /etc/profile.d folder that contains sh script to initialize variable. Make sure to restart the shell and relogin the user, to apply the changes. These files are likely to already contain some assignments, so follow the syntax you see already present in your file. etc/profile for Bourne-like shells, /etc/csh.login for (t)csh, and /etc/zsh/zprofile and /etc/zsh/zshrc for zsh.Īnother option is to use /etc/environment, which on Linux systems is read by the PAM module pam_env and supports only simple assignments, not shell-style expansions. If you want to make it permanent for all users, you can edit the corresponding files under /etc/, i.e. Setenv ORACLE_HOME /usr/lib/oracle/11.2/client64 Setenv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib ORACLE_HOME=/usr/lib/oracle/11.2/client64 LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib Set -Ux ORACLE_HOME /usr/lib/oracle/11.2/client64 Bash as non-login non-interactive shell will load the configuration specified in environment variable $BASH_ENVĮxport LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/libĮxport ORACLE_HOME=/usr/lib/oracle/11.2/client64įish set -Ux LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib.Bash as non-login interactive shell will load ~/.bashrc.Bash as login shell will load /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile in the order.To change the environmental variable "permanently" you'll need to consider at least these situations: profile or your login shell profile file (located in your home directory).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |