mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 13:01:39 -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
|
||||
guard $ isNumber state word
|
||||
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 ()
|
||||
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue