inactive="{ \"text\": \"x\", \"tooltip\": \"emacs is not running.\" }\n" active="{ \"text\": \"e+\", \"tooltip\": \"emacs is running.\" }\n" pgrep emacs >/dev/null if [ $? -eq 1 ] then echo $inactive else echo $active fi