Skip to content

Instantly share code, notes, and snippets.

@zeeshanalisyed
Created July 16, 2018 06:41
Show Gist options
  • Select an option

  • Save zeeshanalisyed/13897ef88cf6da7e9c70393c945c8709 to your computer and use it in GitHub Desktop.

Select an option

Save zeeshanalisyed/13897ef88cf6da7e9c70393c945c8709 to your computer and use it in GitHub Desktop.
bash function sets the environment variable
#!/bin/bash
# @description: add this file to path /bin/
# set_env_var variable_name variable value
VAR=$1
VAL=$2
set_env_v () {
echo 'export '$1'='$2 >> /home/$USER/.bashrc
}
set_env_v $VAR $VAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment