You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many languages allow alternate branches with else if, but sh is not one of them. Use elif instead.
Exceptions:
else if is a valid (though confusing) way of nesting an if statement in a parent's else. If this is your intention, consider using canonical formatting by putting a linefeed between else and if.
This does not change the behavior of the script, but merely makes it more obvious to ShellCheck (and other humans) that you didn't expect the else if to behave the way it does in C. Alternatively, you can ignore it with no ill effects.
if x
thenecho"x"else# line break hereif y
thenecho"y"fifi