Created
February 14, 2019 01:33
-
-
Save jgaydos/678dfffcee7bcf843d88dd2f15b584f1 to your computer and use it in GitHub Desktop.
Setting system variables when they wont stick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is useful for setting variables when they will not stick | |
echo "Enter variable name: " | |
read variable_name | |
echo "Enter variable value: " | |
read variable_value | |
echo "adding " $variable_name " to einvironment variables: " $variable_value | |
echo "export "$variable_name"="$variable_value>>~/.bashrc | |
echo $variable_name"="$variable_value>>~/.profile | |
echo $variable_name"="$variable_value>>/etc/environment | |
source ~/.bashrc | |
source ~/.profile | |
echo "do you wanna restart your computer to apply changes in /etc/environment file? yes(y)no(n)" | |
read restart | |
case $restart in | |
y) sudo shutdown -r 0;; | |
n) echo "don't forget to restart your computer manually";; | |
esac | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment