bash-tutorial/tutorial/variables.org

33 lines
771 B
Org Mode
Raw Normal View History

2022-07-18 14:23:28 +02:00
#+options: toc:nil num:nil author:nil
2022-07-03 21:06:29 +02:00
* Variables and how to add a directory to $PATH
System variables are stored in users environment
- ~$PATH~ Finds the content of a variable ("PATH")
- "env" variables defined in shell environment
** Add directory to path
[[https://wiki.archlinux.org/title/Environment_variables]["Environment variables" in: Arch wiki]]
To add a directory to the PATH for local usage, put
the following in "~/.bash_profile":
#+begin_example bash
export PATH="${PATH}:/home/my_user/bin"
#+end_example
This will add the directory at the end of $PATH. To update the variable, re-login or source the file:
#+begin_example bash
source ~/.bash_profile
#+end_example
Then check directories in "$PATH"
#+begin_example bash
echo $PATH
#+end_example