Why is an empty loop invalid in shell script?

Viewed 7881

I wanted to make my shell script wait infinitely and thought the below code would do it.

#!/bin/bash
while true
do
done

However, the above script reports syntax error.

./Infinite_Loop.sh: line 4: syntax error near unexpected token `done'

./Infinite_Loop.sh: line 4: `done'

Unlike programming languages, why does shell script expect at least one statement in loops?

4 Answers
Related