Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. GNU nano 2.7.4 Fichier : script
  2.  
  3. #!/bin/bash
  4.  
  5. while [ x$username = "x" ]; do
  6.  
  7.  
  8. file="/etc/userstest" #fichier contenant la liste des users
  9. while IFS=' ' read -r name username #definition du delimiter + argument a lire
  10. do
  11. # affichage de name et username
  12. printf 'Prenom: %s, Nom: %s\n' "$f1" "$f2"
  13. done <"$file"
  14.  
  15. if id -u $username >/dev/null 2>&1; then
  16.  
  17. echo "User already exists"
  18. $username = $username+$name
  19. username=""
  20.  
  21. fi
  22.  
  23. done
  24.  
  25. while [ x$group = "x" ]; do
  26. read -p "Please enter the primary group. If group not exist, it will be created : " group
  27.  
  28. if id -g $group >/dev/null 2>&1; then
  29. echo "Group exist"
  30. else
  31. groupadd $group
  32. fi
  33.  
  34. done
  35.  
  36. ^G Aide ^O Écrire ^W Chercher ^K Couper ^J Justifier ^C Pos. cur. ^Y Page préc.
  37. ^X Quitter ^R Lire fich. ^\ Remplacer ^U Coller ^T Analyse stati^_ Aller lig. ^V Page suiv.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement