Select server with bash case based on IP subnet

From DevOps Notebook
#!/bin/bash 
server_ip=hostname -I | cut -d' ' -f1
    


case "$server_ip" in
    10.5.15.*)
    backup_ip=10.5.15.242
    ;;
    10.8.15.*)
    backup_ip=10.8.15.242
    ;;
	10.5.12.*)
    backup_ip=10.5.12.142
    ;;
esac

echo "$backup_ip"