% wc a.c 10 20 131 a.cIf you look at the manual page for wc you will see that it also supports the command line options -l, -w, and -c, which indicate that it should only report the number of lines, number of words, or number of characters, rather than all three. If more than one such option is given, only the counts requested are displayed:
% wc -l -w a.c 10 20 a.c
If dir-wc is invoked with no directory name provided, it should work on the current directory. Otherwise, it should produce a single line of output for each directory it processes, as in this sample:
% ./dir-wcYour script should also support the following command line options, patterned after wc:
.: 2 files, 280 lines, 1121 words, 7174 characters% ./dir-wc . ..
.: 2 files, 280 lines, 1121 words, 7174 characters
..: 33 files, 3686 lines, 15789 words, 142823 characters
% ./dir-wc -l -f -w 7Within your script, you can use wc to calculate the totals for a single file. Be careful to exclude subdirectory names (and files in subdirectories) from all of your counts. As in the previous assignment, your script should start with the proper bang line and include normal and error return statements. Also, be sure to use comments in your script to explain what you are doing and how the main statements in your script are supposed to work.
7: 1 files, 147 lines, 580 words% ./dir-wc -l -f -c 7
7: 1 files, 147 lines, 3739 characters% ./dir-wc -f -c 7
7: 1 files, 3739 characters
For comparison, here is the output of a sample dir-wc script run on acorn:
% dir-wc ~mfali ~mfali/WWW /usr/share/zoneinfoYou can use this output to test the numbers produced by your own script. Your shell script will be graded on a DEC Alpha running Digital UNIX, so you should write your script such that it runs correctly under both FreeBSD and Digital UNIX. You can test your script on any of the DEC Alphas (doberman, malamute, rottweiler, boxer, husky) in the lab.
/home/grad/mfali: 49 files, 10155 lines, 48499 words, 720579 characters
/home/grad/mfali/WWW: 15 files, 12653 lines, 88737 words, 4553646 characters
/usr/share/zoneinfo: 14 files, 391 lines, 1945 words, 24443 characters
Also, remember that no late assignments are accepted.