mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 21:41:34 -07:00
Warn about [^..] in Dash (fixes #2361)
This commit is contained in:
parent
290fc8b945
commit
0dd5c67bdf
1 changed files with 2 additions and 2 deletions
|
@ -180,7 +180,7 @@ prop_checkBashisms95 = verify checkBashisms "#!/bin/sh\necho $_"
|
||||||
prop_checkBashisms96 = verifyNot checkBashisms "#!/bin/dash\necho $_"
|
prop_checkBashisms96 = verifyNot checkBashisms "#!/bin/dash\necho $_"
|
||||||
prop_checkBashisms97 = verify checkBashisms "#!/bin/sh\necho ${var,}"
|
prop_checkBashisms97 = verify checkBashisms "#!/bin/sh\necho ${var,}"
|
||||||
prop_checkBashisms98 = verify checkBashisms "#!/bin/sh\necho ${var^^}"
|
prop_checkBashisms98 = verify checkBashisms "#!/bin/sh\necho ${var^^}"
|
||||||
prop_checkBashisms99 = verifyNot checkBashisms "#!/bin/dash\necho [^f]oo"
|
prop_checkBashisms99 = verify checkBashisms "#!/bin/dash\necho [^f]oo"
|
||||||
checkBashisms = ForShell [Sh, Dash] $ \t -> do
|
checkBashisms = ForShell [Sh, Dash] $ \t -> do
|
||||||
params <- ask
|
params <- ask
|
||||||
kludge params t
|
kludge params t
|
||||||
|
@ -235,7 +235,7 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
|
||||||
where
|
where
|
||||||
file = onlyLiteralString word
|
file = onlyLiteralString word
|
||||||
isNetworked = any (`isPrefixOf` file) ["/dev/tcp", "/dev/udp"]
|
isNetworked = any (`isPrefixOf` file) ["/dev/tcp", "/dev/udp"]
|
||||||
bashism (T_Glob id str) | not isDash && "[^" `isInfixOf` str =
|
bashism (T_Glob id str) | "[^" `isInfixOf` str =
|
||||||
warnMsg id 3026 "^ in place of ! in glob bracket expressions is"
|
warnMsg id 3026 "^ in place of ! in glob bracket expressions is"
|
||||||
|
|
||||||
bashism t@(TA_Variable id str _) | isBashVariable str =
|
bashism t@(TA_Variable id str _) | isBashVariable str =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue