From 838e62d61f7e25b96143ba314db9145bcce203e4 Mon Sep 17 00:00:00 2001 From: nathandarnell Date: Wed, 7 May 2014 19:23:47 -0700 Subject: [PATCH] Created SC2009 (markdown) --- SC2009.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 SC2009.md diff --git a/SC2009.md b/SC2009.md new file mode 100644 index 0000000..95794c3 --- /dev/null +++ b/SC2009.md @@ -0,0 +1,12 @@ +# SC2009 Consider using pgrep instead of grepping ps output. + +## Problematic Code: + +`ps ax | grep -v grep | grep "$service" > /dev/null` + +## Correct Code: + +`pgrep -f "$service" > /dev/null` + +## Source +This seemed to work for me but I am no expert. \ No newline at end of file