TP python

This commit is contained in:
Votre Nom
2023-10-09 17:11:49 +02:00
parent ce7de1abb0
commit 8b71aef87b
3 changed files with 73 additions and 0 deletions

19
sio2/SISR/Python/creatusr Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python3
try:
fh = open("user.txt", "r")
except:
print ("Fichier user.txt inconnu")
else:
line = fh.readline ()
while line:
# use realine() to read next line
maligne = line.rstrip()
(login,complet)=maligne.split(":")
print(login , complet)
cmd = "useradd -m -c \""+ complet + "\" " + login + "-s /bin/bash/ "+login
print (cmd)
line = fh.readline()
fh.close()