From 58b8e0ab707255ddc41d2098ef9be2d6b4878b88 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 31 Aug 2013 18:32:07 -0700 Subject: [PATCH] Suggest pgrep when grepping ps --- ShellCheck/Analytics.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index 0cba0d8..f761785 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -364,6 +364,9 @@ checkPipePitfalls (T_Pipeline id commands) = do for ["?", "echo"] $ \(_:echo:_) -> info (getId echo) "echo doesn't read from stdin, are you sure you should be piping to it?" + for' ["ps", "grep"] $ + flip info "Consider using pgrep instead of grepping ps output." + didLs <- liftM or . sequence $ [ for' ["ls", "grep"] $ flip warn "Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.",