I'm given the following ".txt" file, containing a list of usernames:
user1, user2, user3, user4, user5, user6, user6, user7, user8, user9, user10
From the following, I have to create different users, using each value as the username and same value for the password.
I've tried to, from that list, create a new one writing the usernames in columns, and then create the users from that new .txt file.
IFS=$'\n'
lst1=$(cat /path/of/file/a.txt)
for i in $lst1
do
a1=$(echo $i |awk '{print $1}')
useradd $a1
a2=$(echo $i | awk'{print $1}') echo-e "$a2\n$a2" | passwd $a1
done
But it's not working at all..., I can't take the comma out from the string, and it doesn't allow me to create the user.
Anyone could advice me on how to do it properly?