userspanel.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/bash
  2. #Guzmán Castanedo (guzman@castanedo.es) Octubre 2017
  3. #Licencia: GPL3 (http://www.gnu.org/licenses/gpl-3.0.html)
  4. function escalarPrivilegios {
  5. }
  6. function menu {
  7. #Muestra menu y captura respuesta
  8. if [ $error = false ]; then
  9. clear
  10. fi
  11. printf "/---------------------------------------\\ \n"
  12. printf "|\tADMINISTRACION DE USUARIOS:\t|\n"
  13. printf "\\---------------------------------------/\n"
  14. printf "\t1.\tDar de ALTA Usuario\n"
  15. printf "\t2.\tCambio de Clave\n"
  16. printf "\t3.\tDat de BAJA Usuario\n"
  17. printf "\t4.\tBLOQUEAR Usuario\n"
  18. printf "\t5.\tDESBLOQUEAR Usuario\n"
  19. printf "\ts.\tDar de ALTA Usuario\n"
  20. printf "\tOPCION:\t>"
  21. read Opcion
  22. printf "\n"
  23. }
  24. escalarPrivilegios
  25. cont=true
  26. error=false
  27. while [ $cont = true ]; do
  28. menu
  29. case $Opcion in
  30. 1)
  31. #Alta usuario
  32. ;;
  33. 2)
  34. #Cambiar passwd
  35. ;;
  36. 3)
  37. #Baja usuario
  38. ;;
  39. 4)
  40. #Bloquear usuario
  41. ;;
  42. 5)
  43. #Desbloquear usuario
  44. ;;
  45. s|S|q|Q)
  46. #Salida
  47. #Podreamos hacer break, pero los bucles infinitos son feos.
  48. cont=false
  49. ;;
  50. *)
  51. #Opcion Incorrecta
  52. clear
  53. printf "\tOPCION INCORRECTA.\n"
  54. error=true
  55. continue
  56. ;;
  57. esac
  58. error=false
  59. done
  60. exit