COSC 224: Unix OS and C Programming
Attempt all the questions
1. Write a shell program script logic that allows only fred and cate to execute a
program, and only from the terminals tty08 and tty09. (6 marks)
2. Write a perl program that prompts a user to repeatedly enter an integer number.
When the user enters 0, the program should print the average and the total. The
program should capture all the numbers entered and their total in a file
“numbers.txt”. (6 marks)
3. You have downloaded a file named latest.tex. Explain how you would get this
document formatted and printed. What commands would be used to create and
print PDF and PS versions of the document (6 marks)
4. Write two versions of a file comparison utility fcompare. One version should be
implemented in Shell and the other in Perl. It operates as follows; (6 marks)
% fcompare file1 file2
files are identical
The program should perform basic file checking (file exists) and display
appropriate error messages in the event of file errors e.g.
% fcompare old new fcompare: File does not exist %
5. Write a perl script for creating a backup for every file in the current working
directory. Every backup file shall be named “file”_backup where “file” is the file
name that you are backing up (6 marks)