-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2057
Vidar Holen edited this page Feb 18, 2018
·
3 revisions
[ "$var" -leq 42 ]
[ "$var" -le 42 ]
You are using an unknown binary operator in a test
expression. Choose one that exists.
In bash, use help test
to see a list of supported operators:
FILE1 -nt FILE2 True if file1 is newer than file2 (according to
modification date).
FILE1 -ot FILE2 True if file1 is older than file2.
FILE1 -ef FILE2 True if file1 is a hard link to file2.
STRING1 = STRING2
True if the strings are equal.
STRING1 != STRING2
True if the strings are not equal.
STRING1 < STRING2
True if STRING1 sorts before STRING2 lexicographically.
STRING1 > STRING2
True if STRING1 sorts after STRING2 lexicographically.
arg1 OP arg2 Arithmetic tests. OP is one of -eq, -ne,
-lt, -le, -gt, or -ge.
Arithmetic binary operators return true if ARG1 is equal, not-equal,
less-than, less-than-or-equal, greater-than, or greater-than-or-equal
than ARG2.
None. If you've tested and verified that the operator works but the latest version of ShellCheck says it's unknown, please submit a bug report.
- The classic test command on the Bash Hackers wiki.
- The conditional expression on the Bash Hackers wiki.
- Tests and conditionals on the Wooledge BashGuide.