Reputation: 184
for i in `seq 1 100` ;
do
echo manager${i} ansible_host=$$i;
done
$1, $2, $3 etc have value
I want to first execute $i then execute $1 / $2 etc. For example
$i = 5
$5 = 192.168.0.1
finally output which i want to get: manager5 ansible_host=192.168.0.1
Upvotes: 1
Views: 40
Reputation: 785186
You can use this loop:
for i in {1..100}; do
echo "manager$i ansible_host=${!i}"
done
Upvotes: 3