When declaring a variable, you aren't allowed to have spaces around the
= sign, so your
file variable isn't getting set. You also need to prefix it with a
$ sign when you want to iterate through it.
for loop is also never closed, to signify the end of your loop, use the keyword
done. I'm not sure what you want
**id** = **$i** to do, but I'm guessing you want your script to look more like this:
for i in $(cat $file); do
-o fetch_data.%j.out \
-e fetch_data.%j.err \
-J fetch_data << EOF
java -jar /docs/some-tools.jar --library $i
I removed the
i=1 because it doesn't need to be declared before the loop since it will get set automatically. I'm not familiar with
sbatch, but if you have an issue with that command, you may want to post a new question specifically about that.