Well, a $[ is, as far as I can recall, not a valid bash construct so. if you're using bash, your OPLOG variable setting would report error that the test function ([ is just an alias for test where you used it.) was improperly invoked. I think what you want is:
OPLOG=' &>operations.txt' (Those are single-quotes, not back-quotes.)
and that, too, would cause an error in your proposed if statement since all OPLOG does is direct output to your log file, and your then clause contains no output generating statement. (Also, you failed to terminate the if with a required fi, but that may be just because you failed to include all of your script.
I'd suggest you look at the info bash documentation, carefully reading the section about the set command (Found in the Modifying Shell Behavior section [4.3] in the Shell Commands  group.) with particular attention to the -v and -x values.
Last edited by PTrenholme; 11-01-2011 at 12:19 PM.