if true
then
echo hello
fi
fiif true
then
echo hello
fiThis error is typically seen when there are too many fi,
done or esacs, or when there's a
do or then without a corresponding
while, for or if. This is often
due to deleting a loop or conditional statement but not its
terminator.
In some cases, it can even be caused by bad quoting:
var="foo
if [[ $var = "bar ]
then
echo true
fiIn this case, the if ends up inside the double quotes,
leaving the then dangling.
None.
ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.