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