#!/bin/sh -u # File-testing operations by the TEST command in an IF statement. # See the "test" man page for a larger list of file-testing operators. # # NOTE: This script fragment is incomplete - it does not follow all # the script guidelines set out in "script_style.txt". # # -IAN! idallen@idallen.ca # Un-comment one of these to test that pathname: # # path=/bin # path=/dev/null # path=/nosuchfile path=/etc/passwd if [ -e "$path" ] ; then echo "The path '$path' exists" else echo "The path '$path' is missing or" \ "is inaccessible (no permissions)" fi if [ -f "$path" ] ; then echo "The path '$path' exists and is a plain file" else echo "The path '$path' is not a plain file, is missing, or" \ "is inaccessible (no permissions)" fi if [ -r "$path" ] ; then echo "The path '$path' exists and is readable" else echo "The path '$path' is not readable, is missing, or" \ "is inaccessible (no permissions)" fi if [ -s "$path" ] ; then echo "The path '$path' exists and has a size bigger than zero" else echo "The path '$path' is empty (zero size), is missing, or" \ "is inaccessible (no permissions)" fi