Python
This commit is contained in:
26
sio2/sisr/20-python/creatusr.py
Normal file
26
sio2/sisr/20-python/creatusr.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
nbarg = len(sys.arg)
|
||||
|
||||
if nbarg !=2
|
||||
print ("Nombre d'arguments invalides")
|
||||
exit (1)
|
||||
filename = sys.arg[1]
|
||||
|
||||
try:
|
||||
fh = open("user.txt", "r")
|
||||
except:
|
||||
print ("Fichier user.txt inconnu")
|
||||
else:
|
||||
line = fh.readline ()
|
||||
while line:
|
||||
nouvline = line.rstrip()
|
||||
login.nomlong = nouvline.split(':')
|
||||
print (nbarg)
|
||||
#useradd (login)
|
||||
line = fh.readline()
|
||||
|
||||
fh.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user