While loop in shell script not working in the linux bash shell
<p>Am kind of newbie in writing shell scripts in linux. Its a <code>csh</code> script but am running it in the <code>bash</code> shell that why I used <code>#!/bin/bash</code> instead of <code>#!/bin/csh</code>.</p>

<pre><code>  1 #!/bin/bash
  2 set i = 1
  3 echo it starts
  4 
  5 while ($i &lt;= 5)
  6         echo i is $i
  7         @ i= $i +1
  8 end
</code></pre>

<p>**Note: ** The numbers are just to number the lines.</p>

<p>The above code gives me the output with error: </p>

<blockquote>
<pre><code>it starts
./me.csh: line 9: syntax error: unexpected end of file
</code></pre>
</blockquote>

<p>I can't figure out what is wrong even though it echos <code>it starts</code> and there is no line number 9 as specified in the error.</p>