Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove path from environment variables

Tags:

bash

macos

For mistake I have added a path that I don't want to use.
I have create a file named .base_profile, exported the path using the command source .base_profile, but I don't need this path, how to delete it?

Maybe the title wasn't so appropriate, but I haven't modified the PATH variable.
I have written this in the .base_profile file:

export MP=$MP/usr/local/mysql/bin

And then used the source command.The problem is with the MP variable, which is not one that I want, it's too long.I want to delete it, how to do it?

like image 810
Ramy Al Zuhouri Avatar asked May 08 '12 17:05

Ramy Al Zuhouri


3 Answers

The way to restore your path to the default is PATH=$(getconf PATH)

like image 109
glenn jackman Avatar answered Sep 23 '22 03:09

glenn jackman


Do an

echo $PATH

Then grab with the mouse that part, which looks useful, and append it to:

PATH=

So for example - not on an OSX-System:

PATH=/home/ramy/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

If you only sourced the path in one terminal, you can, alternatively, open a new terminal.

If you added the source-command to one configuration script, you have to remove it there, to get rid of it permananetly.

like image 31
user unknown Avatar answered Sep 23 '22 03:09

user unknown


Fix your errors in the file, and fix the env var with

export PATH=[the correct one]

like image 24
pizza Avatar answered Sep 21 '22 03:09

pizza