You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hestiacp/bin/v-get-user-value

48 lines
1.3 KiB

#!/bin/bash
# info: get user value
# options: USER KEY
#
# example: v-get-user-value admin FNAME
#
# This function for obtaining certain user's parameters.
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Argument definition
user=$1
key=$(echo "$2" | tr '[:lower:]' '[:upper:]')
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER KEY'
is_format_valid 'user' 'key'
is_object_valid 'user' 'USER' "$user"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Checking key
value=$(get_user_value "$key")
# Printing value
echo "$value"
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
exit