diff --git a/ubuntu/README.md b/ubuntu/README.md index b8bba36..0938c50 100644 --- a/ubuntu/README.md +++ b/ubuntu/README.md @@ -50,7 +50,8 @@ $ sudo usermod -aG docker ${USER} // excecute, read, write $ chmod 777 filename -// +// made executable +$ chmod +x envtest.sh ``` ## node version manager [nvm](https://github.com/nvm-sh/nvm) @@ -95,3 +96,54 @@ $ ssh-copy-id -i abc@host ``` +* environments + +```shell +// add global variable +// method1 : cli +$ export VARNAME="value" +$ set VARNAME="Value" + +// add local variable +$ VARNAME=Value + +// remove +$ unset VARNAME +$ VARNAME='' + +// user wide env +$ sudo vi ~/.bashrc + +.. +export NAME=Value +... + +// system wide ENV file +$ nano /etc/environment + +// reload a file +$ source /etc/bash.bashrc + +// show a variable +$ echo $VARNAME + +// show all variables +$ printenv | sort | less +$ env | grep GNOME + +$ myvar=(first second third) +$ echo ${myvar[2]} +third +$ echo ${myvar[*]} +first second third + +``` + +* startup file execution order from login shell + * `/etc/profile` + * `$HOME/.bash_login` + * `$HOME/.bash_profile` + * `$HOME/.profile` + +* startup file from interactive shell + * `.bashrc` instead of `/etc/profile`