Skip to content

Files

Latest commit

 

History

History
40 lines (29 loc) · 639 Bytes

SC1131.md

File metadata and controls

40 lines (29 loc) · 639 Bytes

Pattern: Use of elseif/elsif

Issue: -

Description

You appear to be using elseif or elsif as a keyword. This is not valid.

sh instead uses elif as its alternative branch keyword.

Example of incorrect code:

if false
then
  echo "hi"
elseif true
then
  echo "ho"
fi

Example of correct code:

if false
then
  echo "hi"
elif true
then
  echo "ho"
fi

Exceptions

If you have made your own function called elseif and intend to call it, you can ignore this message.

Further Reading