You may work in pairs, if space demands.                 
The purpose of this assignment is to get more experience writing Linux
scripts using bash
and other commands. You will create and edit a
bash script called pwval
that uses many of the features of shell
scripts described in the lecture.
                
Lines in /etc/passwd
looks like this:
                
root:x:0:0:root:/root:/bin/bash applin:$1$ABCEc3XC$3GRtcuWtLxZ.4SinXGTey0:2464:1555:Jack Applin:/s/parsons/d/fac/applin:/bin/bash
The fields, separated by colons, are:                 
You will write a bash
script called pwval
that ensures
that /etc/passwd
is good. It will:
                
/etc/passwd
/etc/group
If an argument is given, then it is a file to be used instead
of /etc/passwd
. This is useful for testing.
                
Think of this program as something to be executed every day, from cron
.
Therefore, it should be relatively quiet. It shouldn’t say anything,
unless bad things are detected.
                
However, when the script does emit an error message, it must contain sufficient information to track down the problem. For example, an error message that simply says “duplicate user name” is insufficient—the message must specify, at least, what the duplicate user name is.                 
All error messages must include the name of the file (not always
/etc/passwd
) that is being processed. Also, error messages must
include $0
, so that it’s clear where the messages are coming from.
                
All temporary files should be in /tmp
. Use $$
to ensure
a unique file name. Don’t leave any temporary files around.
                
When you have tested your script, and it works, show your work to the TA.                 
Modified: 2015-09-16T19:47                  User: Guest                  Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |