Pidof snippets

This post demonstrates bash code checking if program is running

How to check if a program f.e. htop is currently running

pidof example

#!/bin/bash
PRG=htop
RUNNING=$(pidof "$PRG")
if [ -z "$RUNNING" ]; then
  echo "$PRG" is NOT running
else
  echo "$PRG" is running
fi