From 0aa21fff5edffdba89d0aa899cfa4bd94c1fbf9a Mon Sep 17 00:00:00 2001 From: hugmouse Date: Wed, 19 Jun 2024 18:58:15 +0200 Subject: [PATCH] refactor: make AWK required for this script to run --- yabs.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/yabs.sh b/yabs.sh index 7fe7488..e14df9a 100644 --- a/yabs.sh +++ b/yabs.sh @@ -26,7 +26,7 @@ function check_command() { } # Check for required commands and add warnings if not available -REQUIRED_COMMANDS=("locale" "uname" "getconf" "awk" "sed" "grep" "cut" "shuf" "timeout" "date" "trap" "df" "free" "systemd-detect-virt") +REQUIRED_COMMANDS=("locale" "uname" "getconf" "sed" "grep" "cut" "shuf" "timeout" "date" "trap" "df" "free" "systemd-detect-virt") echo -e "\nChecking available commands" echo -e "---------------------------------" @@ -52,6 +52,16 @@ else exit 1 fi +# Check for AWK +if check_command "awk"; then + echo -e "awk : \xE2\x9C\x94 installed" +else + echo -e "awk : \xE2\x9D\x8C not installed" + echo -e "\nError: 'awk' command found. Please install one of those to continue, script heavily relies on it." + echo -e + exit 1 +fi + echo -e if check_command "date"; then date