にループで1から200までの範囲で変数を使用する方法:この場合私はいくつかのレコードを取得するためのスクリプトはbash持っ
#!/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
を、すべてがOKです。私が持っている:
192.168.1.1 = test1.test.com
192.168.1.2 = test2.test.com
192.168.1.3 = test3.test.com
...
...
...
etc ...
しかし、その代わりにリテラル{1..200}
のを、私は私のスクリプトの先頭で変数を使用します。私はこれでした:私のエラーが
dig: 'test{1..200}.test.com' is not a legal name (empty label)
です:この場合
t1=1
t2=200
for host in "${host_start}"{$t1..$t2}."$domain";
do
...
を、私はエラーを取得しますか?どうすれば修正できますか?
@chepnerを。 –