Hello Everyone, I am some what new to Fedora, but I do know my way around pretty good. I am currently taking a Linux (Fedora) class in college. This week was all about programming and scripting. I personally hate programming but its one of those things that is good to know.... anyways so here is my problem. I have to write a script to include the following:
You have to write a script that reads a list of user names. The script should also check if the user account exists. For this check to see if the user' home directory exists. If the user account does exist, then display a message stating so, if it does not exist, then create it with the following command
useradd -m account_name
In this command, account_name is the name of the user account and will be represented by a variable in your script. To properly test the script make sure that your list includes names that are on your system as well as names that do not exist.
Note: Since you are creating new accounts with this script, it will have to be run as root.
I already have the list made up and some accounts are on my computer and some are not. The biggest problem I am having with this is the code to see if the users home directory exists and what variable to use with adduser -m account_name.
If someone could please point me in the right direction or give me an example of how the script should be written. I had to do some basic If Then....Else If... Case....For Loop..... and While Loop scripts which were not a problem, this is the only one I am not sure about. Thanks in advance for any help