Reputation: 17
while running this code , I get this error:
syntax error near unexpected token ('
touch FILE$i FILE($i+1);'
what is wrong ?
#!/bin/bash
for ((i=1; i<=99; i++ ));
do
touch FILE$i FILE($i+1);
ln -s FILE$i FILE($i+1);
done
Upvotes: 0
Views: 148
Reputation: 246764
To do arithmetic, use the $((...))
syntax:
touch FILE$i FILE$(($i+1))
See https://www.gnu.org/software/bash/manual/bash.html#Arithmetic-Expansion
Upvotes: 1