Advertisement
britodfbr

set_proxy.sh

Apr 28th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. PATH=/bin:/usr/bin:/sbin:/usr/sbin
  4. IP=`ifconfig |grep -Eo '([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){3}'|head -1`
  5.  
  6. echo $IP
  7.  
  8. NET=`awk -F. '{print $1"."$2"."$3}' <<< $IP`
  9. echo $NET
  10.  
  11. if [ "$NET" == "10.10.0" ]; then
  12.    export http_proxy=http://10.10.0.14:8080
  13.    export https_proxy=http://10.10.0.14:8080
  14.    export ftp_proxy=http://10.10.0.14:8080
  15. else
  16.    export http_proxy=http://10.1.1.101:8080
  17.    export https_proxy=http://10.1.1.101:8080
  18.    export ftp_proxy=http://10.1.1.101:8080
  19. fi
  20.  
  21. export no_proxy="10.10.0.150,localhost"
  22.  
  23. echo $http_proxy $https_proxy $ftp_proxy $no_proxy
  24. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement