title: For loop range in Bash
body: <p>Im trying a code in bash to generate prime nos as follows:</p>
  
  <pre><code>#!/bin/bash
  
  
  echo "Enter till where u wish to generate"
  read num
  echo "Generating prime numbers from 2 to $num"
  
  flag="prime"
  
  for i in {2..$num}
  do
  
  for j in {2..$((${num}-1))}
   do
  
   [ $((${i}%${j})) -eq 0 ] &amp;&amp; flag="nprime" || flag="prime"
   break
   done
  
   [ "$flag" == "prime" ] &amp;&amp; echo "$i"
  
  done
  </code></pre>
  
  <p>Upon execution, it throws an error because the for loop takes the sequence mentioned in the curly braces as it is not as a sequence.
  Could you guide me as to where am i going wrong ?</p>