Why is “& ;” invalid syntax?

后端 未结 1 1653
抹茶落季
抹茶落季 2021-01-25 10:55

I am trying to run a for loop on the terminal where I want to send each iteration to background process so that all of them run simultaneously.

Following is the command

相关标签:
1条回答
  • 2021-01-25 11:37

    & and ; both terminate the command that precedes them.

    You can't write & ; any more than you could write ; ; or & &, because the language only allows a command to be terminated once (and doesn't permit a zero-word list as a command).


    Thus: for i in *.src; do fastq-dump --split-files "$i" & done is perfectly correct as-is, and does not require an additional ;.

    0 讨论(0)
提交回复
热议问题