From f549aad8099320061ff489813891d599663b261b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 5 Apr 2014 16:53:09 -0700 Subject: [PATCH] Suggest grep -c for grep|wc --- ShellCheck/Analytics.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index b7a6a48..16afe21 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -477,6 +477,9 @@ checkPipePitfalls _ (T_Pipeline id _ commands) = do for' ["ps", "grep"] $ \x -> info x 2009 "Consider using pgrep instead of grepping ps output." + for' ["grep", "wc"] $ + \x -> style x 2126 "Consider using grep -c instead of grep|wc." + didLs <- liftM or . sequence $ [ for' ["ls", "grep"] $ \x -> warn x 2010 "Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.",