CSc 3320:Midterm 1 solved

Original price was: $35.00.Current price is: $30.00.



5/5 - (2 votes)

Questions 1-5 are 20pts each

1. Pick any of your 10 favourite unix commands. For each command
run the man command and copy the text that is printed into a
mandatabase.txt. Write a shell script that will ask the
user to type in a command and then print the manual’s text
associated with that corresponding command. If the command the
user types is not in the database then the script must print
sorry, I cannot help you

2. On your computer open your favourite Wikipedia page. Copy the
text from that page into a text file myexamfile.txt and then copy
that file to a directory named midterm (use mkdir to create the
directory if it doesn’t exist) in your snowball server home directory
(use any FTP tool such as Putty or Filezilla to copy the file from
your computer to the remote snowball server machine: see Lab 6).
Write a shell script that will find the number of occurrences of a
particular keyword typed by the user.

Present evidence of your
testing with at least 5 trials (different keywords each time)
3. Write a shell script to find files in a directory hierarchy (e.g. your
home directory) that have not been accessed for N days and
compress them. Here N is a parameter and the user will be asked
for that input as the first step of the script execution.

4. Build a phone-book utility that allows you to access and modify an
alphabetical list of names, addresses and telephone numbers. Use
utilities such as awk and sed, to maintain and edit the file of
phone-book information. The user (in this case, you) must be able
to read, edit, and delete the phone book contents. The permissions
for the phone book database must be such that it is inaccessible to
anybody other than the user.

A. Write a C script that will compute the factorial of a given number
(positive integer).
B. Write a C script to find the new integer value of an original
integer when it is bit-shifted left by 3 bits and added to its
complement (one’s complement of the original integer).
(Note: You can manually type in the binary representation of the
original integer)
(10 bonus points for writing the C script to convert the integer to
binary and vice-versa)
(10 bonus points for writing a shell script that will execute both the
C scripts from above for a given integer number)