I want to write in a bash script a piece of code that checks if a program is already running. I have the following in order to search whether bar is running
Sure:
ps -ef | grep bar | { grep -v grep || true; }
Or even:
ps -ef | grep bar | grep -v grep | cat