Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -
- #===============================================================================
- #
- # FILE: user-add.sh
- #
- # USAGE: ./user-add.sh
- #
- # DESCRIPTION:
- #
- # OPTIONS: ---
- # REQUIREMENTS: ---
- # BUGS: ---
- # NOTES: ---
- # AUTHOR: Your Name (),
- # ORGANIZATION: FH Südwestfalen, Iserlohn, Germany
- # CREATED: 13.11.2015 12:38
- # REVISION: ---
- #===============================================================================
- set -o nounset # Treat unset variables as an error
- #------------
- #Prüfen, ob als root angemeldet
- #------------
- if ! [ $UID = 0 ]
- then
- echo -e "\n\tScript nur als root ausführbar!"
- exit 1
- fi
- #------------
- #Aufruf / Anzahl der Abrufparameter überprüfen
- #------------
- if [ ${#} -lt 1 ]
- then
- echo -e "\n\tAufruf: $0 Dateiname\n"
- exit 2
- fi
- #------------
- #Auf Existenz oder Berechtigung prüfen
- #------------
- if ! [ -r $1 ]
- then
- echo -e "\n\t$0 exisitert nicht, oder keine Berechtigung!\n"
- exit 3
- fi
- #------------
- #Parameter
- #------------
- timestamp=$(date +"%Y%m%d-%H%M%S");
- eingabedatei=($1);
- password=$(pwgen 8 1);
- #------------
- #Datei lesen
- #------------
- while read line
- do
- vorname=$(echo "$line" | cut -f 1)
- echo $vorname
- done < "$eingabedatei"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement