forked from guillaume.emorine/siotp
Nouveau fichier : sisr1/scripts/createLogins.sh
This commit is contained in:
parent
74db3e8588
commit
6364bbb5a2
19
sisr1/scripts/createLogins.sh
Normal file
19
sisr1/scripts/createLogins.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/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 $line ./temptp4.txt
|
||||||
|
echo $id","$passwd","$surname","$name","$group >> logins.csv
|
||||||
|
rm ./temptp4.txt
|
||||||
|
|
||||||
|
done < ./Users.csv
|
Loading…
x
Reference in New Issue
Block a user