#!/bin/bash

# Check if correct number of arguments is provided
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <start_vmid> <end_vmid>"
    exit 1
fi

start_vmid=$1
end_vmid=$2

# Loop through the range of VMIDs using while loop
vmid=$start_vmid
while [ "$vmid" -le "$end_vmid" ]; do
    ip=$(lxc-info -i -n "$vmid" | awk '{print $2}')
    
    if [ -n "$ip" ]; then
        echo "$vmid $ip"
    else
        echo "$vmid No IP found"
    fi

    vmid=$((vmid + 1))
done
