Create a program called get_name.pl and save it on the UISACAD5 server in a folder named project3. This program reads the passwd.bak file in the /etc directory on the UISACAD5 server, queries a username and returns the user ID and the user's home directory. The relevant fields are fields number two and number five in the /etc/passwd.bak. Start counting the first field or column as zero, then one, then two, etc. The fields are separated by a colon.

The program can be run by calling the program name followed by one argument or parameter; that is, enter the program name and the username (UIS account) in the command line. For example,

$get_name.pl username

The screen output would be:

User ID: user's ID number
Home directory: /home/username

If the username is not found, the screen output would be:

User: username does not exist.

If there is no argument or if more than one argument is entered, the screen output would be:

Please enter one argument only.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.