Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have HTTP_PROXY defined in default my environment (by ~/.bash_profile), how can I unset the variable from a script?

I know that I can do unset HTTP_PROXY from the command line, but if I try to put this command in a script and run it, HTTP_PROXY is still defined. If I load the script using bash or source, it is still defined.

share|improve this question
Could you post an example script? – Jeremy Kerr Mar 2 '11 at 14:09
up vote 3 down vote accepted

When you run a script it will be executed in a separate child process which cannot affect the environment variables in the parent process (i.e. your interactive shell). However if you use the "source" command it will read lines from the script file and execute them in the current shell, so that should work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.