Приглашаем посетить
Аксаков К.С. (aksakov-k-s.lit-info.ru)

Section 11.6.  Exercises

Previous
Table of Contents
Next

11.6. Exercises

See Appendix A for answers to the following exercises:

  1. [15] Make a program that takes a list of files named on the command line and reports for each one whether it's readable, writable, executable, or doesn't exist. (Hint: It may be helpful to have a function that will do all of the file tests for one file at a time.) What does it report about a file which has been chmod'ed to 0? (That is, if you're on a Unix system, use the command chmod 0some_file to mark that file as neither being readable, writable, nor executable.) In most shells, use a star as the argument to mean all of the normal files in the current directory. That is, you could type something like ./ex11-1 * to ask the program for the attributes of many files at once.

  2. [10] Make a program to identify the oldest file named on the command line and report its age in days. What does it do if the list is empty (that is, if no files are mentioned on the command line)?

    Previous
    Table of Contents
    Next