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
Joachim Ansorg edited this page Oct 31, 2022
·
6 revisions
Scripts are case-sensitive. Use if, not If.
Problematic code:
If true
Then
echo"hello"
Fi
Correct code:
iftruethenecho"hello"fi
Rationale:
Shells are case sensitive and do not accept If or IF in place of lowercase if.
Exceptions
If you're aware of this and insist on naming a function WHILE, you can quote the name to prevent shellcheck from thinking you meant while. Or if you really want the names, add things like alias If=if IF=if to replace those keywords and ask shellcheck to ignore them.