Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. source=$(cat $1)
  4. counter=0;
  5. username="";
  6. login="";
  7. password="";
  8. while IFS='' read -r line || [[ -n "$line" ]]
  9. do
  10.     let "counter += 1"
  11.     if [[ counter -eq 1 ]]
  12.     then
  13.         username=$line
  14.     elif [[ counter -eq 2 ]]
  15.     then
  16.         login=$line
  17.     else
  18.     then
  19.         password=$line
  20.         adduser $login --gecos "$username" --disabled-password && echo "$login:$password" | chpasswd
  21.        
  22.         username=""
  23.         login=""
  24.         password=""
  25.         let "counter = 0"
  26.     fi
  27. done < "$1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement