Let's take a simple for loop#!/bin/bashfor i in `seq 1 10`;do    echo $idoneAFAIK semicolon in bash scripts makes shell execute current command synchronously and then go to the next one.Pressing enter does literally the same except it doesn't allow you to enter the following command, flushing the buffer immediately.So why shell can't interpret the following linefor i in `seq 1 10`; do; echo $i; donehow does this for loop actually work?
How to make a for loop in command line?
bash;shell
The syntax of a for loop from the bash manual page isfor name [ [ in [ word ... ] ] ; ] do list ; doneThe semicolons may be replaced with carriage returns, as noted elsewhere in the bash manual page: A sequence of one or more newlines may appear in a list instead of a semicolon to delimit commands.However, the reverse is not true: you cannot arbitrarily replace newlines with semicolons, as you have done to convert your multiline script to the form:for i in `seq 1 10`; do; echo $i; done