Skip to content

Instantly share code, notes, and snippets.

@J1nH4ng
Last active February 14, 2025 14:41
Show Gist options
  • Save J1nH4ng/3015da69a294cbd4210576d008cf72ba to your computer and use it in GitHub Desktop.
Save J1nH4ng/3015da69a294cbd4210576d008cf72ba to your computer and use it in GitHub Desktop.
check_4r3al_ip(){ expected_ip=$1; current_ip=$(ip addr show wlo1|grep 'inet '|awk '{print $2}'|cut -d'/' -f1); if [ "$current_ip" == "$expected_ip" ]; then echo -e "\033[1;32m验证通过\033[0m -- 当前 IP 地址为:\033[1;33m${current_ip}\033[0m"; else echo -e "\033[1;31m验证不通过\033[0m -- 当前 IP 地址为:\033[1;33m${current_ip}\033[0m,预期 IP 地址为:\033[1;33m${expected_ip}\033[0m,请退出检查配置!"; fi; }
clear
check_4r3al_ip 127.0.0.1
for i in {1..4}; do history -d $(history 1 | awk '{print $1}'); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment