vfini_
This commit is contained in:
parent
7fd118154e
commit
d99426d607
sisr1/tp04_scripts_admin
@ -1,25 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
fichier_a_lire='./Users.csv'
|
||||
fichier_a_ecrire='./logins.csv'
|
||||
file='./Users.csv'
|
||||
loginfile='./logins.csv'
|
||||
|
||||
# Suppression du fichier
|
||||
rm $fichier_a_ecrire 2> /dev/null # Redirection des erreurs
|
||||
rm $loginfile 2> /dev/null # Redirection des erreurs
|
||||
# Création du fichier login.csv
|
||||
touch $fichier_a_ecrire
|
||||
touch $loginfile
|
||||
|
||||
while read ligne
|
||||
do
|
||||
aecrire=""
|
||||
writelogin=""
|
||||
# A chaque itération, stocker le prénom dans $prenom
|
||||
prenom=$(echo $ligne | cut -d "," -f1)
|
||||
first_name=$(echo $ligne | cut -d "," -f1)
|
||||
# A chaque itération, stocker le nom dans $nom
|
||||
nom=$(echo $ligne | cut -d "," -f2)
|
||||
# A chaque itération, stocker le métier dans $metier
|
||||
last_name=$(echo $ligne | cut -d "," -f2)
|
||||
# A chaque itération, stocker le groupe utilisateur dans $group
|
||||
group=$(echo $ligne | cut -d "," -f5)
|
||||
login=?
|
||||
password=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 12; echo)
|
||||
# A chaque itération, stocker l'identifiant dans $login
|
||||
login=$(echo $first_name | cut -c1)$last_name
|
||||
# permert de transformer les majuscule en minuscule
|
||||
login=$(echo $login | tr [:upper:] [:lower:])
|
||||
# permet de supprimer les caractères spéciaux
|
||||
login=$(echo $login | tr -dc [:alnum:])
|
||||
# A chaque itération, stocker le mot de passe dans $password
|
||||
password=$(tr -dc A-Za-z0-9 </dev/urandom | head -c8)
|
||||
|
||||
echo $aecrire >> $fichier_a_ecrire
|
||||
done < $fichier_a_lire
|
||||
# A chaque itération, stocker les informations récupéraient précédement dans $writelogin
|
||||
writelogin="$login;$password;$first_name;$last_name;$group"
|
||||
|
||||
echo $writelogin >> $loginfile
|
||||
done < $file
|
||||
|
||||
|
@ -1,30 +1,30 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
eberthelmot;fbg3nGCr;Ermengarde;Berthelmot;Accountant
|
||||
kbunker;9BzXt6Xm;Kassi;Bunker;Production
|
||||
mmccallum;hV3TRJ73;Moises;McCallum;Production
|
||||
plune;oSfQHuvg;Patrizio;Lune;Accountant
|
||||
beverix;2f7B6btu;Blanch;Everix;Accountant
|
||||
skibbel;bVj3HByx;Stafani;Kibbel;Production
|
||||
imosdell;GJ1sNsGp;Ignacius;Mosdell;Management
|
||||
jwallerbridge;8ih7RbsF;Jeana;Waller-Bridge;Management
|
||||
edressel;Bw2xaoqL;Elroy;Dressel;Production
|
||||
tstrettell;qJnW4Qup;Thea;Strettell;Production
|
||||
sinsoll;2Kv0LM1x;Solomon;Insoll;Accountant
|
||||
cfeedome;yoxs6ala;Carri;Feedome;Accountant
|
||||
pchetwind;95n2yWyF;Padraic;Chetwind;Management
|
||||
sdugo;RWM6KyGw;Solly;D'Ugo;Production
|
||||
kmaccostigan;mZ2bsgTg;Konstanze;MacCostigan;Accountant
|
||||
rpowlesland;0MSFqeGE;Roxane;Powlesland;Management
|
||||
okennealy;3Wa2lRuz;Orelle;Kennealy;Production
|
||||
ssoitoux;vctbRwz9;Sukey;Soitoux;Production
|
||||
nsyce;X6v2Z4iA;Nelli;Syce;Production
|
||||
cshillam;4bbmoVDK;Clarisse;Shillam;Production
|
||||
cgueny;EuSp7vrP;Carin;Gueny;Management
|
||||
driepel;7c6bSIyH;Donny;Riepel;Production
|
||||
dralfe;d0uYqva6;Daniella;Ralfe;Production
|
||||
lclynmans;JXUvA7DR;Lexy;Clynmans;Production
|
||||
gadamthwaite;TryAdrjv;Gardiner;Adamthwaite;Production
|
||||
wlippett;uME9caqd;Woodman;Lippett;Production
|
||||
nmunnion;pBfKA2AO;Nadya;Munnion;Production
|
||||
lhabershon;FoDzxdD9;Llewellyn;Habershon;Production
|
||||
igreatrex;tOhtpET4;Isaak;Greatrex;Production
|
||||
dfrostdyke;H18DkhbJ;Darill;Frostdyke;Production
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user