Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to temporarily set the system wide proxy option which is available as GUI in the Network Settings through bash script. I only want the proxy to be applicable while the script is running and has to reset to no proxy when the script ends. So, basically, I am looking for something like:

----Script Start----

Change Proxy to a predefined IP, port combination

Run

On close, reset proxy

----Script End-----

Now, I saw something on setting the environment variable but I am not sure how to apply this temporarily.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Type the following command to set proxy server in linux command line.

export http_proxy=http://1.2.3.4:3128/

Put a back tick character (`) before and after that command so that bash will execute the EXPORT command.

Note: 1.2.3.4 is your proxy server ip address and 3128 is the port for example.

To remove the variable value, use this command.

unset VARIABLE_NAME

Exmaple:

unset http_proxy

share|improve this answer
    
Thank you! This works perfectly –  rahules Sep 26 '13 at 19:27
    
This is not where the proxy info I gave at install time went.. :\ –  Doc Mar 21 at 2:52

Your Answer

 
discard

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.