| Start | ||||
|---|---|---|---|---|
| Add a path to the PATH environment variable The PATH environment variable is generally defined in ~/.bashrc or ~/.bash_profile or /etc/profile or ~/.profile or /etc/bash.bashrc (distro specific Bash configuration file) Now, if we want to add a path (e.g But this will modify the PATH only in the current shell (and its subshell). Once you exit the shell, this modification will be gone. To make it permanent, we need to add that bit of code to the ~/.bashrc (or whatever) file and reload the file. If you run the following code (in terminal), it will add Explanation:
|
||||
| Remove a path from the PATH environment variable To remove a PATH from a PATH environment variable, you need to edit ~/.bashrc or ~/.bash_profile or /etc/profile or ~/.profile or /etc/bash.bashrc (distro specific) file and remove the assignment for that particular path. Instead of finding the exact assignment, you could just do a replacement in the The following will safely remove To make it permanent, you will need to add it at the end of your bash configuration file. This will make it easier to handle multiple paths. Notes:
Syntax
Parameters
RemarksBash configuration file: This file is sourced whenever a new interactive Bash shell is started. In GNU/Linux systems it's generally the ~/.bashrc file; in Mac it's ~/.bash_profile or ~/.profile Export: The PATH variable must be exported once (It's done by default). Once it is exported it will remain exported and any changes made to it will be applied immediately. Apply changes: To apply changes to a Bash configuration file, you must reload that file in a terminal ( |
Read Article
https://develop.horje.com/learn/1434/reference