Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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?

share|improve this question

marked as duplicate by 1_CR, 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

1 Answer 1

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

share|improve this answer

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