set environment variable in linux code example

Example 1: shell set environment variable

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

Example 2: linux set environment

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

# example
setenv SHELL /usr/bin/bash

Example 3: add environment variable linux

vi ~/.bash_profile

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