mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-11 02:02:54 +08:00
Added bashism warning for &>
This commit is contained in:
@@ -350,6 +350,7 @@ prop_checkBashisms14= verify checkBashisms "echo -n \"Foo: \""
|
|||||||
prop_checkBashisms15= verify checkBashisms "let n++"
|
prop_checkBashisms15= verify checkBashisms "let n++"
|
||||||
prop_checkBashisms16= verify checkBashisms "echo $RANDOM"
|
prop_checkBashisms16= verify checkBashisms "echo $RANDOM"
|
||||||
prop_checkBashisms17= verify checkBashisms "echo $((RANDOM%6+1))"
|
prop_checkBashisms17= verify checkBashisms "echo $((RANDOM%6+1))"
|
||||||
|
prop_checkBashisms18= verify checkBashisms "foo &> /dev/null"
|
||||||
checkBashisms = bashism
|
checkBashisms = bashism
|
||||||
where
|
where
|
||||||
errMsg id s = err id $ "#!/bin/sh was specified, so " ++ s ++ " is not supported, even when sh is actually bash."
|
errMsg id s = err id $ "#!/bin/sh was specified, so " ++ s ++ " is not supported, even when sh is actually bash."
|
||||||
@@ -374,6 +375,7 @@ checkBashisms = bashism
|
|||||||
bashism t@(T_SimpleCommand id _ _)
|
bashism t@(T_SimpleCommand id _ _)
|
||||||
| t `isCommand` "source" =
|
| t `isCommand` "source" =
|
||||||
warnMsg id "'source' in place of '.'"
|
warnMsg id "'source' in place of '.'"
|
||||||
|
bashism (T_FdRedirect id "&" (T_IoFile _ (T_Greater _) _)) = warnMsg id "&>"
|
||||||
bashism (T_DollarBraced id token) =
|
bashism (T_DollarBraced id token) =
|
||||||
mapM_ check expansion
|
mapM_ check expansion
|
||||||
where
|
where
|
||||||
|
Reference in New Issue
Block a user