After run this scrip:
#!/bin/bash
if (($# > 1)) && [ "$1" == "-F" ]; then
while read ano turma inf sup
do
for (( i=$inf ; $i<=$sup ; i++ ));
do if (( $i <= 9 )); then p="aluno$ano";
p=$p$turma;
s="0$i";
qq="$p$s";
else s="$i";
qq="aluno$ano";
qq=$qq$turma$s; fi
(lat-users -a -c "$qq|aluno|$ano$turma$s|$ano$turma$s|||||||||alunos$ano$turma");
(lat-quota -c "$qq|17M|20M");
(mkdir /home/e-smith/files/users/$qq/home/Meus\ Documentos);
(chown $qq /home/e-smith/files/users/$qq/home/Meus\ Documentos);
(chgrp $qq /home/e-smith/files/users/$qq/home/Meus\ Documentos);
done;
done < $2;
fi
if (($# > 1)) && [ "$1" == "-A" ]; then
for (( i=$4 ; $i<=$5 ; i++ ));
do if (( $i <= 9 )); then p="aluno$2$3";
s="0$i";
qq="$p$s";
else s="$i";
qq="aluno$2$3$s"; fi
(lat-users -a -c "$qq|aluno|$2$3$s|$2$3$s|||||||||alunos$2$3");
(lat-quota -c "$qq|17M|20M");
(mkdir /home/e-smith/files/users/$qq/home/Meus\ Documentos);
(chown $qq /home/e-smith/files/users/$qq/home/Meus\ Documentos);
(chgrp $qq /home/e-smith/files/users/$qq/home/Meus\ Documentos);
done;
fi;
if (( $# < 2 )); then echo "USO: cria_utilizadores -A «ano» «turma» «limite inferior» «limite superior»"; echo "Ex. cria_utilizadores -A 10 a 1 25"; echo "Ex. cria_utilizadores -F «nome do ficheiro»";
fi
width this file:
7 a 1 28
7 b 1 28
7 c 1 28
7 d 1 20
7 e 1 23
8 a 1 20
8 b 1 23
8 c 1 22
8 d 1 22
8 e 1 25
9 a 1 18
9 b 1 20
9 c 1 26
9 d 1 20
10 a 1 16
10 b 1 28
10 c 1 28
10 d 1 19
10 e 1 28
10 f 1 28
10 g 1 17
10 h 1 19
11 a 1 27
11 b 1 22
11 c 1 24
11 d 1 17
11 e 1 26
11 f 1 10
11 g 1 15
12 a 1 27
12 b 1 28
12 c 1 25
12 d 1 16
12 e 1 24
12 f 1 23
12 g 1 16
i can't log on server-manger and users can't change password
