赞
踩
背景:在日常公司处理过程中,因公司代理软件存在一些bug,在非正常退出时候未关闭系统代理功能,导致浏览器无法访问网页。在这种情况,只需要在网络设置中关闭代理功能即可解决,但因有些人不熟悉系统,找不到相关设置,所特写了相关脚本交由员工运行即可关闭。暂只写了Mac版本的,Windows后续有时间补上。
#- - - - - - - - -- --Script comment information - - - - - - - - - - #Author: 拉基 #Email: helpdesk81@outlook.com #Creation time: 2023-09-21 #FileName: proxy.sh #Blog address: https://www.cnblogs.com/98record/ #Copyright (C) 2023All rights reserved #- - - - - - - - - - - - - end - - - - - - - - - - - - - - - - - - IFS=$'\n' # 设置分隔符为换行符 interfaces=($(networksetup -listallnetworkservices | tail -n +2)) for interface in "${interfaces[@]}"; do # 去除末尾可能的空格 interface=$(echo "${interface}" | xargs) # 关闭自动发现代理 sudo networksetup -setproxyautodiscovery "${interface}" off # 关闭自动配置代理 sudo networksetup -setautoproxystate "${interface}" off # 关闭网页代理(HTTP) sudo networksetup -setwebproxystate "${interface}" off # 关闭安全网页代理(HTTPS) sudo networksetup -setsecurewebproxystate "${interface}" off # 关闭SOCKS代理 sudo networksetup -setsocksfirewallproxystate "${interface}" off done
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。