permanent environment variables linux code example

Example 1: linux set env permanent

# for bash
Bash as login shell will load /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile in the order
Bash as non-login interactive shell will load ~/.bashrc
Bash as non-login non-interactive shell will load the configuration specified in environment variable $BASH_ENV

$cat ~/.profile
#add lines at the bottom of the file:  
     export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
     export ORACLE_HOME=/usr/lib/oracle/11.2/client64
     
 #OR
 nano /etc/environment

Example 2: shell set environment variable

export VARNAME="my value"      # shorter, less portable version

Example 3: set permanant environemt variable

$EDITOR ~/.profile
#add lines at the bottom of the file:  
     export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
     export ORACLE_HOME=/usr/lib/oracle/11.2/client64

Example 4: set environment variable linux

vi ~/.bash_profile

Example 5: linux set environment variable

# Linux - Bash 

# syntax 
# export *<variable-name>=*<variable-value>;

# example 
export ORACLE_SID='sales_database';