Skip to content

Instantly share code, notes, and snippets.

@saurabhwahile
Created March 22, 2015 16:43
Show Gist options
  • Save saurabhwahile/60c89a26cab71c21fc82 to your computer and use it in GitHub Desktop.
Save saurabhwahile/60c89a26cab71c21fc82 to your computer and use it in GitHub Desktop.
Set proxy based on ip address
#replace th0 with interface name and the 1st ip with nic ip and 2nd ip with proxy ip
ip="$(ifconfig eth0|grep 'inet addr'|awk -F':' '{print $2}'| awk -F' ' '{print $1}')"
if [[ $ip = "172.24.0.2" ]]
then
export http_proxy="http://172.24.0.1:3128"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment