I have a CSV table with Students of a school which includes firstname, lastname, Day of Entry and Day of leaving.
My CSV-File looks like this: Table of the Students
I already started with the code for adding Users but this script would add a User for everyone in this CSV-File
#!/bin/bash
OLDIFS=$IFS
IFS=";"
while read firstname lastname
do
useradd -c "${firstname} ${lastname}" -d /home/"${firstname}" -G group1 -s /bin/bash "${lastname}"
done < file.csv
Now I have to code the Bash script so that it reads the day of leaving, compares it to the current date and if the day of leaving is in the future then the script should add a User using the Names in the Tablerow.
Next part is that the script should deactivate every User whose day of Leaving already passed. And after 4 weeks the User should be deleted.
I´m pretty new to bash and I wasn´t able to find anything useable on the Internet. Sorry for my bad English. ^^"