I have script for getting some records:
#!/bin/bash
host_start=test
domain=test.com
for host in "${host_start}"{1..200}."$domain";
do
address=`dig +short $host`
echo "$address = $host"
done
In this case, everything is OK. I have:
192.168.1.1 = test1.test.com
192.168.1.2 = test2.test.com
192.168.1.3 = test3.test.com
...
...
...
etc ...
But instead of the literal {1..200}
, I want to use variables in the start of my script. I did this:
t1=1
t2=200
for host in "${host_start}"{$t1..$t2}."$domain";
do
...
In this case, I get an error:
dig: 'test{1..200}.test.com' is not a legal name (empty label)
Where is my error? How do I fix it?