|
@@ -21,14 +21,13 @@ function leerComando {
|
|
|
#Muestrar linea de comando y capturar comando.
|
|
|
force=false
|
|
|
remove=false
|
|
|
- printf "$(basename $0)>\t"
|
|
|
+ printf "$(basename $0)> "
|
|
|
read Comando
|
|
|
- #printf "\n"
|
|
|
#Parseamos la linea de comando con todas las opciones posibles.
|
|
|
- printf "$Comando\n"
|
|
|
+ #printf "$Comando\n"
|
|
|
Temp=$(getopt -q -o d:g:G:p:s:fre: --long home-dir:,gid:,groups:,password:,shell:,force,remove,expiredate: -- $Comando)
|
|
|
eval set -- "$Temp"
|
|
|
- printf "$Temp\n"
|
|
|
+ #printf "$Temp\n"
|
|
|
while true; do
|
|
|
case "$1" in
|
|
|
-d|--home-dir)
|
|
@@ -75,7 +74,7 @@ function leerComando {
|
|
|
done
|
|
|
Opcion=$1
|
|
|
User=$2
|
|
|
- printf "Opcion: $Opcion\tUsuario: $User\n"
|
|
|
+ #printf "Opcion: $Opcion\tUsuario: $User\n"
|
|
|
unset Comando Temp
|
|
|
}
|
|
|
|
|
@@ -154,7 +153,7 @@ function altaUsuario {
|
|
|
return 1
|
|
|
;;
|
|
|
esac
|
|
|
- printf "useradd $opciones $User\n"
|
|
|
+ #printf "useradd $opciones $User\n"
|
|
|
useradd $opciones $User
|
|
|
if [ $? -ne 0 ]; then
|
|
|
printf "ERROR FATAL: No se ha podido crear el usuario.\n"
|
|
@@ -200,7 +199,7 @@ function bajaUsuario {
|
|
|
return 1
|
|
|
;;
|
|
|
esac
|
|
|
- printf "userdel$opciones $User\n"
|
|
|
+ #printf "userdel$opciones $User\n"
|
|
|
userdel$opciones $User
|
|
|
return 0
|
|
|
}
|
|
@@ -269,7 +268,7 @@ function bloquearUsuario {
|
|
|
;;
|
|
|
esac
|
|
|
fi
|
|
|
- usermod -e $expireDate $user
|
|
|
+ usermod -e $expireDate $User
|
|
|
if [ $? -ne 0 ]; then
|
|
|
printf "ERROR FATAL: No se ha podido bloquear usuario $User.\n"
|
|
|
return 1
|
|
@@ -291,13 +290,13 @@ function desbloquearUsuario {
|
|
|
return 1
|
|
|
fi
|
|
|
estaBloqueado
|
|
|
- if [ $? -eq 0 ]; then
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
printf "$User no esta bloqueado.\n"
|
|
|
printf "Escribir \"bloquear\" para desbloquear usuario.\n"
|
|
|
return 1
|
|
|
fi
|
|
|
- printf "Fecha de Bloqueo de $User: %s" $(fechaBloqueado)
|
|
|
- printf "(QDESBLOQUEAR? [S/N])> "
|
|
|
+ printf "Fecha de Bloqueo de $User: %s\n" $(fechaBloqueado)
|
|
|
+ printf "(DESBLOQUEAR? [S/N])> "
|
|
|
read correcto
|
|
|
case $correcto in
|
|
|
y|Y|s|S)
|
|
@@ -512,7 +511,7 @@ while [ $cont = true ]; do
|
|
|
ayuda
|
|
|
;;
|
|
|
esac
|
|
|
- unset Opcion User homeDir gid otherGroups password shell force remove expireDate opciones
|
|
|
+ unset Opcion User homeDir gid otherGroups password shell force remove expireDate opciones correcto
|
|
|
done
|
|
|
unset VERSION cont
|
|
|
exit
|