The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 10-26-2005
mschwage mschwage is offline
Registered User
  
 

Join Date: Jul 2005
Location: Oak Park, IL
Posts: 102
Here's something a little more informative, if you need it, but it's in ksh. Dunno if that's normal enough for you. -e is not available in sh:

#!/bin/ksh
if [ -s /path/to/file ] ; then
echo We have a file with stuff in it
elif [ -e /path/to/file ] ; then
echo We have a file with 0-length
else
echo "The file isn't even there!"
fi

do a "man test" on a UNIX box near you.

BTW, if you're on Linux then /sbin/sh is likely really bash, and you can use the -e.