From e50980f025cd460282ecb2b2a3bed7c72250416b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 28 Feb 2017 10:09:54 +0800 Subject: Update command existence check function Credit: * Stackoverflow: Check if a program exists from a Bash script Credit: https://stackoverflow.com/a/677212/4856091 --- _profile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '_profile') diff --git a/_profile b/_profile index 9eda66f..c71bd0b 100644 --- a/_profile +++ b/_profile @@ -31,8 +31,9 @@ _path_append() { } ## Check the existence/accessibility of a command +# Credit: https://stackoverflow.com/a/677212/4856091 _exists() { - which $1 &> /dev/null + command -v "$1" >/dev/null 2>&1 } ## Check whether the program is running -- cgit v1.2.2