Advertisement
Guest User

Untitled

a guest
Oct 27th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. echo "1 - add user\n 2 - read from file\n 3- exit"
  2. while read line
  3. do
  4.  
  5. case $line in
  6. "1")
  7. echo "username:"
  8. read usr
  9. echo "password:"
  10. read -s pwd
  11. useradd $usr -p $(openssl passwd $pwd)
  12. ;;
  13. "2")
  14. echo "filename:"
  15. IFS=','
  16. read filename
  17. while read usr pwd
  18. do
  19. useradd $usr -p $(openssl passwd $pwd)
  20. echo $?
  21. done < $filename
  22. ;;
  23. "3") exit 0 ;;
  24. esac
  25. echo "1 - add user\n 2 - read from file\n 3- exit"
  26. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement