#!/bin/bash # check_ip_location.sh IP_ADDRESS=$1 CITY=$(mmdblookup --file /GeoLite2/GeoLite2-City.mmdb --ip "$IP_ADDRESS" city names en | grep Shanghai) if [ -n "$CITY" ]; then echo "allow" else echo "deny" fi