When i run this script on my machine with the given file i get this error, same when using groupadd command.
#!/bin/bash
while IFS="," read -r first last department
do
department=`echo "${department,,}" | tr -d '\n'`
echo "$department"
echo "$(sudo /usr/sbin/addgroup $department)"
done < <(tail -n +2 EmployeeNames.csv)
EmployeeNames.csv
FirstName,LastName,Department
Iwan,Meza,IT
Bradley,Seymour,Executive
Phillip,Mcdowell,Executive
Abdullah,Davenport,HR
Danni,Bate,Administrative
Agata,Moore,IT
Chance,Knight,Administrative
Darcy,Solomon,Finance
Corinne,Hilton,Finance
Hayley,Miles,Executive
Charli,Reyes,Administrative
Iwan,Meza,IT
Kaira,Fry,Administrative
Veronica,Byrd,Executive
Mccauley,Holding,CallCentre
Rudi,Khan,CallCentre
Chance,Knight,Administrative
Christiana,Nunez,CallCentre
Abubakar,Mclaughlin,Finance
Giles,Durham,CallCentre
Madelaine,Busby,Administrative
Jareth,Blake,CallCentre
Mccauley,Holding,CallCentre
anukul,nukul,kath
I get this error (this is just one error all department returns same error.
kath
addgroup: To avoid problems, the username should consist only of
letters, digits, underscores, periods, at signs and dashes, and not start with
a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba
machine accounts $ is also supported at the end of the username