Ramy Al Zuhouri
Ramy Al Zuhouri

Reputation: 21996

Remove path from environment variables

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?

Upvotes: 6

Views: 13611

Answers (3)

glenn jackman
glenn jackman

Reputation: 247062

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

Upvotes: 7

pizza
pizza

Reputation: 7640

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

export PATH=[the correct one]

Upvotes: 2

user unknown
user unknown

Reputation: 36260

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.

Upvotes: 4

Related Questions