#!/bin/sh -u # # $0 [ pathnames... ] # # A script that identifies empty files, given on the command line. # Non-files, including non-existent pathnames, are skipped over and # are not processed. # # WARNING: Many of the comments in this file are "Instructor-Type" # comments and are *not* appropriate for real scripts. Do not put # "Instructor-Type" comments into the scripts that you submit for marking. # I put them in my example files because I am teaching you how to # write scripts; do not submit my teaching comments back to me again. # Read the week7.txt notes for more details on good comment style. # # -IAN! idallen@ncf.ca June 2001 # All scripts must start with lines similar to these two: # export PATH=/bin:/usr/bin umask 022 # This uses the abbreviated for loop that defaults to using "$@" as # the list of words. # for pathname do # We only process existing files and ignore otherwise. if [ -f "$pathname" ]; then if [ -s "$pathname" ]; then echo "'$pathname' is not empty" else echo "'$pathname' is empty" fi else echo "'$pathname' is not an existing file (ignored)" fi done exit 0