#!/usr/bin/env bash function menu() { echo -e "\033[1;31m ______________________________________________________________________________\033[0m" echo -e "\033[1;31m| |\033[0m" echo -e "\033[1;31m|______________________________________________________________________________|\033[0m" cat </dev/null; then if [ $VALID_CHECK == "yes" ]; then echo "ip $ip available!" return 0 else echo "ip $ip not available!" return 1 fi else echo "ip format error! The setting will be wrong." return 1 fi } while true ; do read -p "Please enter IP: " IP check_ip $IP [ $? - eq 0 ] && break done ! :</dev/null ;then echo "port $port is number." else echo "port format error! the setting will be wrong." fi } while true ; do read -p "Please enter IP: " IP check_ip $IP [ $? - eq 0 ] && break done ! function set_proxy(){ :<> /etc/profile # echo "export https_proxy=https://$ip:$port" >> /etc/profile echo "export http_proxy=http://$ip_port" >> /etc/profile echo "export https_proxy=https://$ip_port" >> /etc/profile check_proxy } function check_proxy(){ source /etc/profile echo "...system proxy is below!...." echo $http_proxy && echo $https_proxy echo "...checking system proxy !..." curl cip.cc sleep 5 exit } function empty_proxy(){ sed -i '/http/d' /etc/profile source /etc/profile echo "...system proxy is empty!..." echo $http_proxy && echo $https_proxy } menu