forked from guillaume.emorine/siotp
Nouveau fichier : sisr1/tp04/auto_nat/nat.service Nouveau fichier : sisr1/tp04/scripts_and_files/Users.csv Nouveau fichier : sisr1/tp04/scripts_and_files/createLogins.sh Nouveau fichier : sisr1/tp04/scripts_and_files/createUsers.sh Nouveau fichier : sisr1/tp04/scripts_and_files/logins.csv Nouveau fichier : sisr1/tp04/scripts_and_files/remoteCreation.sh
18 lines
432 B
Bash
18 lines
432 B
Bash
#!/bin/bash
|
|
#
|
|
rm ./logins.csv
|
|
while read line
|
|
do
|
|
touch ./temptp4.txt
|
|
file='./temptp4.txt'
|
|
echo $line > $file
|
|
surname=$(cut -d "," -f 1 $file)
|
|
name=$(cut -d "," -f 2 $file)
|
|
group=$(cut -d "," -f 5 $file)
|
|
initials=$(cut -c 1 $file)
|
|
id=$(echo $initials$name | tr [:upper:] [:lower:])
|
|
passwd=$(echo $RANDOM | md5sum | head -c 8)
|
|
echo $id","$passwd","$surname","$name","$group>> logins.csv
|
|
rm ./temptp4.txt
|
|
done < ./Users.csv
|