diff options
author | Vidar Holen <spam@vidarholen.net> | 2016-03-08 17:37:12 -0800 |
---|---|---|
committer | Vidar Holen <spam@vidarholen.net> | 2016-03-08 17:37:12 -0800 |
commit | 6af1aeb259955e1c01c69fd5b7717123586c524e (patch) | |
tree | 7d672c23065cce9b3b1547c30ca56456b11dd95d | |
parent | e792d69293a6a81dd92c6070c108ab5f8f8c617a (diff) |
Add warning for multi-digit FDs in posix/dash.
-rw-r--r-- | ShellCheck/Analytics.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 5ed9000..2557a47 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -610,6 +610,7 @@ prop_checkBashisms43= verify checkBashisms "trap foo sigint" prop_checkBashisms44= verifyNot checkBashisms "#!/bin/dash\ntrap foo int" prop_checkBashisms45= verifyNot checkBashisms "#!/bin/dash\ntrap foo INT" prop_checkBashisms46= verify checkBashisms "#!/bin/dash\ntrap foo SIGINT" +prop_checkBashisms47= verify checkBashisms "#!/bin/dash\necho foo 42>/dev/null" checkBashisms params = bashism where isDash = shellType params == Dash @@ -642,6 +643,8 @@ checkBashisms params = bashism bashism (TA_Binary id "**" _ _) = warnMsg id "exponentials are" bashism (T_FdRedirect id "&" (T_IoFile _ (T_Greater _) _)) = warnMsg id "&> is" bashism (T_FdRedirect id ('{':_) _) = warnMsg id "named file descriptors are" + bashism (T_FdRedirect id num _) + | all isDigit num && length num > 1 = warnMsg id "FDs outside 0-9 are" bashism (T_IoFile id _ word) | isNetworked = warnMsg id "/dev/{tcp,udp} is" where |