I need to "write a script to add users to your system in which user names are assigned to the script as an argument n (in ?, spell error by Professor) format text file
Last_Name First_Name Middle_Initial Group
(other FYI instructions). The script should create unique user names up to 8 characters long and generate random passwords for users. Users should be assigned home directories depending on the group in which they are located. You can assume that users will belong to Management ("mgmt"), "Employee" ("empl"), or "Temporary" ("temp"), and that their respective directories are under these group names in / home. For example, if John Doe is in "mgmt." And his username is jdoe1234, then his home directory should be in / Home / Ctrl / jdoe1234. Lock home directories so that no one has permissions for home directories than the users themselves. Your script should generate a file called users.txt,which contains the following columns:
Surname Name Password UID
which can be used to distribute usernames and passwords to users.
The first part (not in italics) is what confuses me. If I understand his wording correctly, he wants me to take the text from a separate file .txtand use it as arguments for my script? With an idea
./file.sh arg1 arg2 arg3 arg4
besides these arguments will be the first four words in the txt file? Say if the .txt file contains "Doe John A empl" then it will be like input
./file.sh arg1 arg2 arg3 arg4
Here is my attempt so far (I really tried other things, but this is what I have on the screen right now, sort of where I started):
#!/bin/bash
echo "$(cat file.txt)"
lname=$(echo $1|head -c 3)//to make username use first 3 letters of last name
fname=$(echo $2|head -c 1)//to make username use first letter of first name
mname=$3
group=$4
echo "$lname$fname$mname$group"
, . , , , .txt , . , . , . ? , , script, , , , , .txt.