refactor: make AWK required for this script to run

This commit is contained in:
hugmouse 2024-06-19 18:58:15 +02:00
commit 0aa21fff5e
No known key found for this signature in database
GPG key ID: 45FDB5FAB7ECB522

12
yabs.sh
View file

@ -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