feat: improve env command injecting

This commit is contained in:
NekoRectifier
2023-12-12 20:32:17 +08:00
parent 607fa2afde
commit cfa14d6fc3
3 changed files with 63 additions and 25 deletions

20
scripts/functions.bash Normal file
View File

@ -0,0 +1,20 @@
function proxy_on() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export no_proxy=127.0.0.1,localhost
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
export NO_PROXY=127.0.0.1,localhost
echo -e "\033[32m[√] 已开启代理\033[0m"
}
# 关闭系统代理
function proxy_off(){
unset http_proxy
unset https_proxy
unset no_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset NO_PROXY
echo -e "\033[31m[×] 已关闭代理\033[0m"
}

21
scripts/functions.fish Normal file
View File

@ -0,0 +1,21 @@
# 开启系统代理
function proxy_on
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export no_proxy=127.0.0.1,localhost
export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890
export NO_PROXY=127.0.0.1,localhost
echo -e "\033[32m[√] 已开启代理\033[0m"
end
# 关闭系统代理
function proxy_off
set -e http_proxy
set -e https_proxy
set -e no_proxy
set -e HTTP_PROXY
set -e HTTPS_PROXY
set -e NO_PROXY
echo -e "\033[31m[×] 已关闭代理\033[0m"
end