#!/bin/sh
# -*- tcl -*-
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

proc ipRange {trio start end} {
    puts "trio: $trio STart: $start END: $end"
    for {set i $start} {$i < $end} {incr i} {
        lappend ips $trio.$i
    }
    return $ips
}

set start 999

puts [ipRange 127.0.0 2 6]
foreach ip [ipRange 192.168.1 2 5] {
    puts "exec ping $ip"
}