From 6a833ff3175526eba37c7a50de17be2ad3289cdc Mon Sep 17 00:00:00 2001 From: Vatsal Gupta <40350810+gvatsal60@users.noreply.github.com> Date: Sun, 27 Sep 2026 09:29:13 +0000 Subject: [PATCH] Add check_cmd function to verify command availability --- .update.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.update.sh b/.update.sh index e768e28..ac220ef 100755 --- a/.update.sh +++ b/.update.sh @@ -40,6 +40,19 @@ print_err() { printf "\n${RED}%s${CLEAR}\n" "$*" >&2 } +# Function: check_cmd +# Description: Checks if a specified command is available in the system. +# Usage: check_cmd "command_name" +check_cmd() { + command_name="$1" + + if ! command -v "${command_name}" >/dev/null 2>&1; then + return 1 + fi + + return 0 +} + # Function: check_command # Description: Checks if a specified command is available in the system. # Prints a message indicating whether the command is installed.