v-list-sys-languages 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # info: list system users
  3. # options: [FORMAT]
  4. #
  5. # The function for obtaining the list of system users without
  6. # detailed information.
  7. #----------------------------------------------------------#
  8. # Variable&Function #
  9. #----------------------------------------------------------#
  10. # Argument defenition
  11. format=${1-shell}
  12. # Includes
  13. source $VESTA/func/main.sh
  14. # Json function
  15. json_list_lang() {
  16. int_counter=$(echo "$languages" | wc -l)
  17. i=1
  18. echo '['
  19. for lang in $languages; do
  20. if [ "$i" -lt "$int_counter" ]; then
  21. echo -e "\t\"$lang\","
  22. else
  23. echo -e "\t\"$lang\""
  24. fi
  25. (( ++i))
  26. done
  27. echo "]"
  28. }
  29. # Shell function
  30. shell_list_lang() {
  31. if [ -z "$nohead" ]; then
  32. echo "LANGUAGES"
  33. echo "----------"
  34. fi
  35. for lang in $languages; do
  36. echo "$lang"
  37. done
  38. }
  39. #----------------------------------------------------------#
  40. # Action #
  41. #----------------------------------------------------------#
  42. # Check languages
  43. languages=$(ls $VESTA/web/inc/i18n/|cut -f 1 -d .)
  44. # Listing domains
  45. case $format in
  46. json) json_list_lang ;;
  47. plain) nohead=1; shell_list_lang ;;
  48. shell) shell_list_lang ;;
  49. *) check_args '1' '0' '[FORMAT]' ;;
  50. esac
  51. #----------------------------------------------------------#
  52. # Vesta #
  53. #----------------------------------------------------------#
  54. exit