how to set env variable in linux 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: how to set environment variables in linux

source ~/.bash_profile

Example 3: linux set environment

# syntax 
# setenv SHELL *<filepath-of-file-containing-environment-settings>

# example
setenv SHELL /usr/bin/bash

Example 4: linux set environment variable

# Linux - Bash 

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

# example 
export ORACLE_SID='sales_database';

Example 5: how to set environment variables in linux

export JAVA_HOME=/opt/openjdk11

Tags:

Misc Example