linux get environment variable code example

Example 1: shell set environment variable

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

Example 2: show env in bash

#show all variable
printenv

#result one variable
echo $LOCALAPPDATA

Example 3: print environment variables linux

ENV_VAR="hello world"
printenv ENV_VAR

Example 4: env variable bash

#print enviornment variable bash
echo $TEST_VAR

Example 5: linux set environment variable

# Linux - Bash 

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

# example 
export ORACLE_SID='sales_database';

Tags:

Misc Example