What I'm trying to do:
./script 192.168.1.{1..100}
#!/bin/expect -f
set servers_ip [lindex $argv 0]
set servers_port [lindex $argv 1]
set timeout -1
foreach ip $servers_ip {
puts "\nIP = $ip"
}
expected output:
IP = 192.168.1.1
IP = 192.168.1.2
IP = 192.168.1.3
Actual output:
IP=192.168.1.1
I just can't make the parameter expansion work, and I CANNOT use external files.
Your shell has already expanded the brace expansion before launching expect. The first 100 elements of $argv are individual IP addresses.
Here, you want
set servers_ip $argv
then, iterating over them should give you what you want