Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Eac
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Eac
Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Each user must also have a password, though in the interest of brevity, they may all be assigned the same one. Provide me the source code and a copy of your system's /etc/passwd file.
accounts.txt includes 1. Pittman,Mckenzie,Sales
2. Donovan,Moriah,Accounting
3. Barnes,Gabriel,Sales
4. Monroe,Maximillian,Management
5. Maynard,Sylvia,Management
6. Mayer,Elise,Accounting
7. Reeves,Stephen,Production
8. Oneill,Sean,Sales
9. Jackson,Hanna,Management
10. Lee,Alani,Production
11. Golden,Ibrahim,Production
12. Tyrese,Todd,Production
Note: it is perfectly acceptable to "leverage" code from another source provided: 1) you understand what the example code is doing, and 2) you write it yourself. Remember to give attribution to any code you use that you didn't write.
Last edited by abdy.r.khalafi@gmail.com; 11-08-2019 at 07:56 AM.
Using the attached file as a "database" of users, develop an application that reads the users.txt file, and adds each one as a new user. Each user must also have a password, though in the interest of brevity, they may all be assigned the same one. Provide me the source code and a copy of your system's /etc/passwd file.
Does the bash guide includes text processing? You will need tools like awk, sed, cut to process the account.txt file.
On RHEL/Centos, there is a newusers command, which may simplify the task (or not). Not sure if other distros have it.
errm
Code:
while IFS=${IFS/#/,} read anumber surname forename department
do
printf "%s %s's department is %s in uppercase for fun\n" \
${forename} \
${surname} \
${department^^}
done < account.txt
now, grep could be used to check username does not already exist
if so, tag ${surname:0:1} on the end
but it could be done without grep
upper lower case may need to be accounted for , I seem to remember having to patch things to get uppercase support, but that was years ago.
Ok...how much credit do we get for doing your homework for you?
Read the LQ Rules about such things. Post reported.
Well he mentioned ---> Note: it is perfectly acceptable to "leverage" code from another source provided: 1) you understand what the example code is doing, and 2) you write it yourself. Remember to give attribution to any code you use that you didn't write.
Well he mentioned ---> Note: it is perfectly acceptable to "leverage" code from another source provided: 1) you understand what the example code is doing, and 2) you write it yourself. Remember to give attribution to any code you use that you didn't write.
Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member.
You have not shown us what you've tried or discussed where you have confusion, you've just posted the assignment and it appears to be verbatim.
Many LQ members are very much capable of completing this type of homework assignment, however it is your assignment and your fellow LQ members, who are all volunteers are not here to provide "on demand" answers. Please show some effort, or at least web search for some of these answers.
Well he mentioned ---> Note: it is perfectly acceptable to "leverage" code from another source provided: 1) you understand what the example code is doing, and 2) you write it yourself. Remember to give attribution to any code you use that you didn't write.
Great! So then show us **YOUR EFFORTS**. We don't have to learn this assignment, you do.
What have you done/tried/researched in order to do this? Because as of now, you posted your homework question, and seem to be expecting us to just answer it for you.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.