mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-09-19 18:19:22 +08:00
Don't warn about expr if using : operator
This commit is contained in:
@@ -312,7 +312,9 @@ checkUuoc _ = return ()
|
|||||||
|
|
||||||
prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)"
|
prop_checkNeedlessCommands = verify checkNeedlessCommands "foo=$(expr 3 + 2)"
|
||||||
prop_checkNeedlessCommands2 = verify checkNeedlessCommands "foo=`echo \\`expr 3 + 2\\``"
|
prop_checkNeedlessCommands2 = verify checkNeedlessCommands "foo=`echo \\`expr 3 + 2\\``"
|
||||||
checkNeedlessCommands (T_SimpleCommand id _ (w:_)) | w `isCommand` "expr" =
|
prop_checkNeedlessCommands3 = verifyNot checkNeedlessCommands "foo=$(expr foo : regex)"
|
||||||
|
checkNeedlessCommands cmd@(T_SimpleCommand id _ (w:_)) |
|
||||||
|
w `isCommand` "expr" && (not $ ":" `elem` deadSimple cmd) =
|
||||||
style id "expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]."
|
style id "expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]."
|
||||||
checkNeedlessCommands _ = return ()
|
checkNeedlessCommands _ = return ()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user