mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Recommend typeset
instead of declare
in SC2324
Bash has both `typeset` and `declare`, but ksh has `typeset` only. Recommend the more portable alternative to users.
This commit is contained in:
parent
50db9a29c4
commit
9cb21c8557
1 changed files with 2 additions and 1 deletions
|
@ -5017,7 +5017,8 @@ checkPlusEqualsNumber params t =
|
||||||
state <- CF.getIncomingState cfga id
|
state <- CF.getIncomingState cfga id
|
||||||
guard $ isNumber state word
|
guard $ isNumber state word
|
||||||
guard . not $ fromMaybe False $ CF.variableMayBeDeclaredInteger state var
|
guard . not $ fromMaybe False $ CF.variableMayBeDeclaredInteger state var
|
||||||
return $ warn id 2324 "var+=1 will append, not increment. Use (( var += 1 )), declare -i var, or quote number to silence."
|
-- Recommend "typeset" because ksh does not have "declare".
|
||||||
|
return $ warn id 2324 "var+=1 will append, not increment. Use (( var += 1 )), typeset -i var, or quote number to silence."
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue