You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `$PATH` variable is one of the default environment variable in linux (ubuntu). It is used by the shell to look for executable files or commands.
4
+
5
+
One way to permanently add a directory to `$PATH` environment variable is to use the `~/.profile` file. Add the following to the `~/.profile` file to add `myNewDir` to `$PATH`
6
+
7
+
```
8
+
$ export PATH=$PATH:/myNewDir
9
+
$ source ~/.profile
10
+
```
11
+
12
+
## The `source` command
13
+
14
+
`source` is a bash shell built-in command that executes the content of the file passed as argument, **in the current shell**. It has a synonym in `.` (period).
15
+
16
+
Note that `./` and `source` are not quite the same:
17
+
18
+
-`./script` runs the script as an executable file, launching a new shell to run it
19
+
-`source some_script` reads and executes commands from filename in the current shell environment
20
+
-`source some_script` is the same as `. some_script`
0 commit comments