file creation inside loop

i=1
while [ $i -lt 18 ]
do
touch TC$i.txt
i=`expr $1 + 1`
done
echo "files created successfully"

What is wrong with code...its running continuosly...

plz help me....

If you want only the change then that is

i=`expr $1 + 1`

to

i=`expr $i + 1`

---> notice it is not $1 it is $i

I assume you know shell scripting already, so am not giving any explanations...

Yes mate...u are correct

Now the script is working

if you are on bash

touch TC{1..18}.txt