Skip to content

Files

Latest commit

 

History

History
35 lines (25 loc) · 545 Bytes

SC1049.md

File metadata and controls

35 lines (25 loc) · 545 Bytes

Pattern: Missing then for if or elif

Issue: -

Description

Your code probably has a missing then keyword for the if or elif.

Note that the then needs a ; or linefeed before it. if true then is invalid, while if true; then is correct.

Example of incorrect code:

if true
  echo "foo"
elif true
  echo "bar"
fi

Example of correct code:

if true
then
  echo "foo"
elif true
then
  echo "bar"
fi

Further Reading