From 770b62c42614375e57bf658c18495784fade0698 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 28 Feb 2017 08:56:35 +0800 Subject: zsh: add function is_running() --- _zsh/40-functions.zsh | 5 +++++ 1 file changed, 5 insertions(+) (limited to '_zsh') diff --git a/_zsh/40-functions.zsh b/_zsh/40-functions.zsh index cd9ebc9..77db01c 100644 --- a/_zsh/40-functions.zsh +++ b/_zsh/40-functions.zsh @@ -4,10 +4,15 @@ # execute 'functions ' to show function details. # +## Check the existence/accessibility of a command function exists() { which $1 &> /dev/null } +## Check whether the program is running +function is_running() { + pgrep -x -u "${USER}" $1 &> /dev/null +} function zsh_recompile() { autoload -U zrecompile -- cgit v1.2.2