From fe2398edc9ed9e644f47f6d73d0832e3af3de398 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 24 Sep 2016 14:03:54 -0700 Subject: [PATCH] Warn about >& in sh --- ShellCheck/Analytics.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index f91e91e..9bdc9da 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -501,6 +501,7 @@ prop_checkBashisms46= verify checkBashisms "#!/bin/dash\ntrap foo SIGINT" prop_checkBashisms47= verify checkBashisms "#!/bin/dash\necho foo 42>/dev/null" prop_checkBashisms48= verifyNot checkBashisms "#!/bin/dash\necho $LINENO" prop_checkBashisms49= verify checkBashisms "#!/bin/dash\necho $MACHTYPE" +prop_checkBashisms50= verify checkBashisms "#!/bin/sh\ncmd >& file" checkBashisms params = bashism where isDash = shellType params == Dash @@ -532,6 +533,7 @@ checkBashisms params = bashism warnMsg id $ filter (/= '|') op ++ " is" bashism (TA_Binary id "**" _ _) = warnMsg id "exponentials are" bashism (T_FdRedirect id "&" (T_IoFile _ (T_Greater _) _)) = warnMsg id "&> is" + bashism (T_FdRedirect id _ (T_IoFile _ (T_GREATAND _) _)) = 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"