Last active
August 29, 2015 14:01
-
-
Save craigpalermo/e31bcd64b07707ec6494 to your computer and use it in GitHub Desktop.
Create an account for each user listed in the external file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Example: | |
# sh create_users.sh file_with_usernames.txt | |
if [ -z "$1"] # check if filename is given | |
then | |
echo "No input filename given, exiting." | |
else | |
while read NAME; do | |
echo "Adding user $NAME"; | |
useradd -m "$NAME"; # add user with home folder | |
done < $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment