This question already has an answer here:

I am trying to use a for do command that I can run as a one liner in Solaris/Linux, and would like the do command to run asynchronously. I have tried the following:

for i in `ls AMQ*.FMT`; do ./mqtrcfrmt.solaris $i $i.2 &; done

but I get an error like the following:

bash: syntax error near unexpected token `;'

Is there a way to get the do part of this for/do command to recognize the ampersand (&) and run this command asynchronously?

marked as duplicate by iruvar, jimmij, jasonwryan, Networker, muru Dec 31 '14 at 20:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In my post, there should have been a ` before and after the ls AMQ*.FMT. – tczielke Dec 31 '14 at 18:30

Do not put a semi-colon after the &. Otherwise this would mean that there is an empty command after it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.