mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2009 (markdown)
12
SC2009.md
Normal file
12
SC2009.md
Normal file
@@ -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.
|
Reference in New Issue
Block a user