v-get-user-value 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # info: get user value
  3. # options: user key
  4. #
  5. # The function for obtaining certain user's parameters.
  6. #----------------------------------------------------------#
  7. # Variable&Function #
  8. #----------------------------------------------------------#
  9. # Argument defenition
  10. user=$1
  11. key=$(echo "$2"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
  12. # Includes
  13. source $VESTA/conf/vesta.conf
  14. source $VESTA/func/main.sh
  15. #----------------------------------------------------------#
  16. # Verifications #
  17. #----------------------------------------------------------#
  18. check_args '2' "$#" 'user key'
  19. validate_format 'user'
  20. is_object_valid 'user' 'USER' "$user"
  21. #----------------------------------------------------------#
  22. # Action #
  23. #----------------------------------------------------------#
  24. # Checking key
  25. value=$(get_user_value "$key")
  26. # Printing value
  27. echo "$value"
  28. #----------------------------------------------------------#
  29. # Vesta #
  30. #----------------------------------------------------------#
  31. exit