linutil/core/tabs/utils/user-account-manager/user-manager-functions.sh
Jeevitha Kannan K S 7533606302
Refactor utility functions
Separate utitility functions into user manager functions and monitor control functions, disable somechecks and formatting
2024-11-21 10:05:44 +05:30

32 lines
572 B
Bash

#!/bin/sh -e
. ../../common-script.sh
checkGroups() {
groups="$1"
available_groups="$2"
for group in $groups; do
if ! echo "$available_groups" | grep -q -w "$group"; then
return 1
fi
done
return 0
}
confirmAction() {
confirm="$1"
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
printf "%b\n" "${RED}Cancelled operation...${RC}" >&2
exit 1
fi
}
checkEmpty() {
if [ -z "$1" ]; then
printf "%b\n" "${RED}Empty value is not allowed${RC}" >&2
exit 1
fi
}
checkEnv