If statement help

I'm trying to create a script that would allow me to identify the sucessful removal of a file. Here's what i put together so far, let me know if it's correct or not.

FILE_NAME="cactus.dat"
FILE_FIND='find / -name $FILE_NAME'

if [ -z $FILE_NAME ] ;then
echo "cactus.dat was not removed successfully"
else
echo "cactus.dat was removed successfully"
fi

The -z test will not work in Bourne shell. It will in Korn - not sure about Bash.
The FILE_FIND command needs backticks - not quotes.
Also, in some forms of 'find' you need a -print command.

So...

FILE_NAME="cactus.dat"
FILE_FIND=`find / -name $FILE_NAME -print`

if [ -z $FILE_FIND ] ;then
# Zero string length - file not found
echo "cactus.dat was removed successfully"
else
echo "cactus.dat was not removed successfully" 
fi

The -z test will not work in Bourne shell. It will in Korn - not sure about Bash. Also, in some forms of 'find' you need a -print command.

Jerry

The -z test will work in all Bourne-type shells.

If you have an old version of find that requires -print (unlikely), you can test success directly:

if find / -name "$FILE_NAME"; then

Use backticks or $( ... ) to capture the output of a command, and quote your variables:

FILE_FIND=$( find / -name "$FILE_NAME" )

Don't you mean:

if [ -z "$FILE_FIND" ] ;then