Skip to content

Commit b7aa91a

Browse files
committed
script used to switch local and remote network
1 parent a50d085 commit b7aa91a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

linux_conf/script/internet

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
#!/bin/bash
2-
export http_proxy=http://xxx.xxx.xxx.xxx:80/
3-
export ftp_proxy=ftp://xxx.xxx.xxx.xxx:80/
4-
export socks_proxy=socks://xxx.xxx.xxx.xxx:80/
5-
export https_proxy=https://xxx.xxx.xxx.xxx:80/
2+
export http_proxy=http://xxxx.xxxx.xxxx.xxxx:80/
3+
export ftp_proxy=ftp://xxxx.xxxx.xxxx.xxxx:80/
4+
export socks_proxy=socks://xxxx.xxxx.xxxx.xxxx:80/
5+
export https_proxy=https://xxxx.xxxx.xxxx.xxxx:80/
6+
7+
SED=$(test $(uname -o) = 'Darwin' && echo gsed || echo sed)
68

79
if [ -z $(git config --global --name-only -l |grep remote.origin.proxy |xargs) ]
810
then
911
git config --global --add remote.origin.proxy ""
1012
fi
11-
gsed -i 's/proxy.*/proxy = xxx\.xxx\.xxx\.xxx:80/' ~/.gitconfig
13+
$SED -i 's/proxy.*/proxy = xxxx\.xxxx\.xxxx\.xxxx:80/' ~/.gitconfig
1214

1315
if [ -z $(git config --global --name-only -l |grep user.name |xargs) ]
1416
then
1517
git config --global --add user.name ""
1618
fi
17-
gsed -i 's/name.*/name = xxxxx/' ~/.gitconfig
19+
$SED -i 's/name.*/name = xxxx/' ~/.gitconfig
1820

1921
if [ -z $(git config --global --name-only -l |grep user.email |xargs) ]
2022
then
2123
git config --global --add user.email ""
2224
fi
23-
gsed -i 's/email.*/email = xxxxx@xxxx.xxx/' ~/.gitconfig
25+
$SED -i 's/email.*/email = xxxx@xxxx.xxxx/' ~/.gitconfig

linux_conf/script/localnet

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
#!/bin/bash
2+
SED=$(test $(uname -o) = 'Darwin' && echo gsed || echo sed)
23
unset http_proxy ftp_proxy socks_proxy https_proxy
34
if [ -z $(git config --global --name-only -l |grep remote.origin.proxy |xargs) ]
45
then
56
git config --global --add remote.origin.proxy ""
67
fi
7-
gsed -i 's/proxy *= *[0-9.:]*/proxy =/' ~/.gitconfig
8+
$SED -i 's/proxy *= *[0-9.:]*/proxy =/' ~/.gitconfig
89

910
if [ -z $(git config --global --name-only -l |grep user.name |xargs) ]
1011
then
1112
git config --global --add user.name ""
1213
fi
13-
gsed -i 's/name.*/name = xxxx/' ~/.gitconfig
14+
$SED -i 's/name.*/name = xxxx/' ~/.gitconfig
1415

1516
if [ -z $(git config --global --name-only -l |grep user.email |xargs) ]
1617
then
1718
git config --global --add user.email ""
1819
fi
19-
gsed -i 's/email.*/email = xxxx@xxx/' ~/.gitconfig
20+
$SED -i 's/email.*/email = xxxx@xxxx/' ~/.gitconfig

0 commit comments

Comments
 (0)