# Week 12, Intro to Unix lab 2016

## Content

• test
• umask, named pipes

## Bonus == Homework

### Pick one option for 3 points for homework

• Write a script junk_finder.sh [-o | -s | -t] [-hbkmg] [dir_path ...]
• (3 points per one option) The options [-o | -s | -t] are mutually exclusive and if none specified -t default option is assumed
• The script accepts a list of directory paths and if none is provided the current path is used.
• Option [-h] prints a help similar to this homework descriptions but which is formatted as in other standard Unix utilities
• The option should print a section LEGAL NOTICE where you state your nickname (and name)
• The option LEGAL NOTICE should also contain license. I encourage you to use Apache 2.0 license.
• The options -b, -k, -m, -g determine a unit with which the script is reporting the file size. The default one is -b
• -b - the script reports sizes in bytes
• -k - the script reports in kilobytes
• -m - the script reports sizes in megabytes
• -g - the script reports sizes in gigabytes
• report only integers, but document how do you round the numbers
• For option -t the scripts computes sizes of all files in directory paths but reports the sizes of files only per file of the files.
• For finding out the file types it is recommended to use file --mime-type command
• For example it will report the total number of pdf files, text files, postscript files in the current directory
• For option -o print relative path and sizes of files which were not modified at least one month and also belong to 10% of files under examined directories which are the oldest (were modified the longest time ago).
• For option -s the script reports the sizes of directories and files in breadth first (top down) manner.
• It first reports the names and sizes of of top-level directories given as arguments
• Then it reports sizes and the relative paths to files and directories in the top level directories and so on.
• Note that this option may be very computational demanding and nontrivial level of caching precomputed information is expected.