改变端口号shell脚本

发布时间 2023-08-12 11:43:22作者: jienow
 1 # 开启端口
 2 function startProxy(){
 3   export https_proxy=https://127.0.0.1:7890;
 4   export http_proxy=http://127.0.0.1:7890;
 5   export all_proxy=socks5://127.0.0.1:7890;
 6 }
 7 # 获取端口
 8 function getProxy(){
 9   echo http_proxy:  $http_proxy;
10   echo https_proxy:  $https_proxy;
11 }
12 # 关闭端口
13 function stopProxy(){
14   unset https_proxy;
15   unset http_proxy;
16   unset all_proxy;
17 }
18 # 开启git端口
19 function gitSetProxy(){
20   # git config --global http.proxy 'socks5://127.0.0.1:7890' 
21   git config --global https.proxy 'socks5://127.0.0.1:7890'
22   git config --global http.https://github.com.proxy 'socks5://127.0.0.1:7890'
23 }
24 # 获取git端口
25 function gitGetProxy(){
26   echo http
27   git config --global --get http.proxy
28   echo https
29   git config --global --get https.proxy
30 }
31 # 取消git端口
32 function gitUnsetProxy(){
33   git config --global --unset http.proxy
34   git config --global --unset https.proxy
35 }
36 
37 startProxy