It's still waiting for the "then" for the first if. And after that, it will want the "fi". The
if syntax requires
then to be on a separate line, or have a semicolon in front; and there must be a
fi to show where the
if block ends.
Consider:
Code:
if grep moo file.txt |
many more commands |
in a complex pipeline |
yielding a result which decides whether the "if" is true or not
then
commands to execute if the outcome was true
there could be many commands here too
many many more, in fact
fi
unconditional commands ...