Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #!/bin/bash -
  2. #===============================================================================
  3. #
  4. # FILE: user-add.sh
  5. #
  6. # USAGE: ./user-add.sh
  7. #
  8. # DESCRIPTION:
  9. #
  10. # OPTIONS: ---
  11. # REQUIREMENTS: ---
  12. # BUGS: ---
  13. # NOTES: ---
  14. # AUTHOR: Your Name (),
  15. # ORGANIZATION: FH Südwestfalen, Iserlohn, Germany
  16. # CREATED: 13.11.2015 12:38
  17. # REVISION: ---
  18. #===============================================================================
  19.  
  20. set -o nounset # Treat unset variables as an error
  21.  
  22. #------------
  23. #Prüfen, ob als root angemeldet
  24. #------------
  25.  
  26. if ! [ $UID = 0 ]
  27. then
  28. echo -e "\n\tScript nur als root ausführbar!"
  29. exit 1
  30. fi
  31.  
  32. #------------
  33. #Aufruf / Anzahl der Abrufparameter überprüfen
  34. #------------
  35.  
  36. if [ ${#} -lt 1 ]
  37. then
  38. echo -e "\n\tAufruf: $0 Dateiname\n"
  39. exit 2
  40. fi
  41.  
  42. #------------
  43. #Auf Existenz oder Berechtigung prüfen
  44. #------------
  45.  
  46. if ! [ -r $1 ]
  47. then
  48. echo -e "\n\t$0 exisitert nicht, oder keine Berechtigung!\n"
  49. exit 3
  50. fi
  51.  
  52. #------------
  53. #Parameter
  54. #------------
  55.  
  56. timestamp=$(date +"%Y%m%d-%H%M%S");
  57. eingabedatei=($1);
  58. password=$(pwgen 8 1);
  59.  
  60.  
  61. #------------
  62. #Datei lesen
  63. #------------
  64.  
  65. while read line
  66. do
  67. vorname=$(echo "$line" | cut -f 1)
  68. echo $vorname
  69. done < "$eingabedatei"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement