title: Using command line arguments in for loop (bash)
body: <p>I'm trying to write a bash script that's supposed to perform reverse DNS lookup on a range of IP addresses. The idea is to provide the network (first 3 octets) as $1, the start of the range to be checked as $2 and the end of said range as $3.</p>
  
  <p>So I ended up with:</p>
  
  <pre><code>#!/bin/bash
  if [ $# -ne 3 ]
  then
      echo "[*] Usage: reverselookup.sh [Network (x.x.x)] [start of range (y)]  [end of range (z)]"
      exit 1
  fi
  
  for ip in {$2..$3}
  do
      host $1.$ip | grep pointer
  done
  </code></pre>
  
  <p>Now I thought that this would use the normal sequence operation in bash for loops, like in</p>
  
  <pre><code>for i in {2..5}
  </code></pre>
  
  <p>gives you a loop with 2, 3, 4 and 5. However it doesn't work.</p>
  
  <p>If I echo the $ip inside the loop and run it as e.g. </p>
  
  <pre><code>reverselookup.sh 192.168.10 21 50
  </code></pre>
  
  <p>it presents me with </p>
  
  <blockquote>
    <p>{21..50}</p>
  </blockquote>
  
  <p>Does anyone know whether it's possible to make this work?
  Or do I have to rethink my appraoch?</p>
  
  <p>Thanks in advance.</p>