#!/usr/bin/env tsh : : tsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " @(#)$Id: 2ddf1105c0bb67da9478a665c2014fb1bcfd5b83 $ " : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " Print information about the specified file or directory, " : " If it is a symbolic link, follow it and indicate this in " : " the output. " : : " Exit with a zero status if the specified file or directory " : " exists. Otherwise, exit with a non-zero status. " : : " usage: finfo file " : : " Check for correct usage. " : >>$0'' <'' ; : >>$1'' <'' ; : >>$2'' <'' ; killer $0 finfo if X$1 = X -o X$2 != X if { exit } pusage $0 file if ! -e $1 if { exit } perror $0 $1'": No such file or directory"' : : " Print the name and type of the specified file. " : echo -n $1' (' if -h $1 echo -n 'symbolic link -> ' if ! { if -d $1 echo 'directory):' } \ if ! { if -f $1 echo 'regular file):' } \ echo 'special file):' : : " Is it readable, writable, and/or executable/searchable? " : if ! { if -r $1 echo ' Read - OK' } \ echo ' Read - Permission denied' if ! { if -w $1 echo ' Write - OK' } \ echo ' Write - Permission denied' if ! { if -x $1 echo ' Execute/Search - OK' } \ echo ' Execute/Search - Permission denied' : zero status