From 7e06c4c8868b8a3f613f2747172aebea3cbcf3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Sat, 13 Apr 2024 22:19:47 +0200 Subject: [PATCH] Added function command_exists into a Update-pkg --- .local/bin/Update-pkg | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.local/bin/Update-pkg b/.local/bin/Update-pkg index 881bf94..7baad41 100755 --- a/.local/bin/Update-pkg +++ b/.local/bin/Update-pkg @@ -51,6 +51,15 @@ function command_start() { timestamp "Command $* has been ended." } +function command_exists() { + if which "$1" > /dev/null 2>&1; then + timestamp "Command $1 has been found" + else + err "Command $1 has been NOT found" + exit 0 + fi +} + function update_pip() { # Update the pip if [[ "$(uname)" == "Darwin" ]]; then