get environment variable bash code example

Example 1: 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 2: env variable bash

#print enviornment variable bash
echo $TEST_VAR

Example 3: bash set environment variable

# Linux - Bash

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

# example 
export ORACLE_SID='sales_database';

Example 4: bash get environment variable

Just type next command to list all environments varialbes in terminal:
printenv

Tags:

Misc Example