That’s actually just fine, but, as with other languages, I prefer to use boolean variables for cleaner code.

Even though there is, technically, no such thing, it is quite easy to implement. It looks like this:

FILE_FOUND=false
# ... some processing to locate the file
# If found, set the flag
FILE_FOUND=true
# ...
if $FILE_FOUND
then
# process the file...
fi

This works because “true” and “false” are actually commands, so $FILE_FOUND executes the “true” or “false” command. “true” always returns 0 and “false” always returns 1. This technique works in all bourne-style shells.

Execution-wise, it really doesn’t make any difference, but I like the cleaner look to the code.