Hi and welcome to LinuxQuestions!
Since it is a homework assignment, you will understand we cannot give the exact solution. Anyway, here is some advice:
1. Check carefully the man page of cut: how do you specify the
LIST as argument of the
-f option? How do you tell cut to separate fields? Hint: look at option
-d.
2. You don't really need to use cat and pipe the results to the cut or the grep commands, since they accept the file name as argument.
3. To complete your script you need to write down the current time. Hint: use the
date command. Finally you have to check if uid and gid 0 are found and send an e-mail alert.
In general you should run each command separately on the command line without redirection to a file, to check the output in real time. This will spare you a lot of time for testing. For example: your first command produce an error:
Code:
$ cat ~c20600/passwd.p4 | cut -f1,f3
cut: invalid byte, character or field list
Try `cut --help' for more information.
Try again and feel free to ask for any further clarification.