I am a beginner at scripting but I created a text file called text.dat which contains only usernames in the file location /home/daniel/text.dat and I’m trying to run a script(called addusers.sh) that displays the names from that text file and will create a new user account on the system for each new user account specified in the text.dat file. For each user account that is created, append a line entry to the /home/daniel/logs/useraccounts.log file. The line entry will contain the following information: added | <user account name> | <day and time of creation>
.
This is what I have so far:
#!/bin/bash
echo “cat text.dat”
newuser= grep /home/daniel/text.dat
sudo adduser $newuser