24 lines
599 B
Bash
24 lines
599 B
Bash
#!/bin/bash
|
|
|
|
fichier_a_lire=./Users.csv
|
|
fichier_a_ecrire=./logins.csv
|
|
|
|
rm $fichier_a_ecrire 2> /dev/null #redirection eror
|
|
touch $fichier_a_ecrire
|
|
|
|
while read ligne
|
|
do
|
|
aecrire=""
|
|
last_name=$(echo $ligne | cut -d "," -f2)
|
|
first_name=$(echo $ligne | cut -d "," -f1)
|
|
group=$(echo $ligne | cut -d "," -f5)
|
|
login=$(echo $first_name | cut -c1)$last_name
|
|
login=$(echo $login | tr [:upper:] [:lower:])
|
|
login=$(echo $login | tr -dc [:alnum:])
|
|
password=$(echo $RANDOM | md5sum | head -c8)
|
|
|
|
aecrire="$login;$password;$first_name;$last_name;$group"
|
|
|
|
echo $aecrire >> $fichier_a_ecrire
|
|
|
|
done < $fichier_a_lire |