<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 10 June 2015 at 06:28, oliver <span dir="ltr"><<a href="mailto:ohemming@gmail.com" target="_blank">ohemming@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On Tue, Jun 9, 2015 at 3:55 PM, Root, Paul T <<a href="mailto:Paul.Root@centurylink.com">Paul.Root@centurylink.com</a>> wrote:<br>
> The solution would be more like:<br>
> echo "if [ \"$FILENAME\" != \"\" -a -e \"$FILENAME\" ]; then"<br>
<br>
</span>Thanks - makes more sense now but I think you added an errant -e in<br>
that solution :-) </blockquote><div><br></div><div>Yes, and no.  The "-e" for "exists" is a required test.  The fact that it isn't supported as such on Solaris Bourne shell (sh) means that we need an alternative.  The solution you proposed is to effectively not test for the file's existence, meaning that if the file exists, no problem, but if the file doesn't exist, error and unknown consequences.<br><br></div><div>Paul's solution was attempting to solve a perceived problem about Solaris Bourne shell's ability to test whether a string is non-empty, and I'm guessing he thought that was the cause of the error.  But it's not.<br><br></div><div>A workable solution is to substitute "-f" for "-e".  The difference between "-f" and "-e" is that "-f" tests for a file that exists AND is a regular file.  In our situation, it's going to be rare that we would want a Xymon file test on a non-file (socket, pipe, device) and so for our purposes, "-f" is a suitable replacement.  Other alternatives that might be suitable are "-r" (exists and is readable) or "-s" (exists and has size >0) but I can imagine cases where these might not fit requirements, so "-f" is probably the most useful alternative.<br><br></div><div>So the following should work:<br><br>
echo "if [ \"$FILENAME\" -a -f \"$FILENAME\" ]; then"<br><br></div><div>Thanks for the bug report.  I'll update the version on my site in the next day or so.<br><br></div><div>Cheers<br></div><div>Jeremy<br><br></div></div></div></div>