The problem is that when your file is older than 18 hours your find command returns the filename not a true/false.

So you end up with

Code:
if [ /Users/tonyfabris/Documents/Test Folder/test-file ]


which has two "parameters" hence the error. When there's no space bash seems to return true for just a single parameter

When find doesn't match the file it returns "null" i.e.

Code:
if [ ]; then


Quick fix (I'm no bash expert). Something like:

Code:
#!/bin/bash

# This works as expected:
testFile="/build/christian/tmp/nospace-file"

# This produces the error "Unary Operator Expected"
# when it hits the "find" command because of the
# space in the path name:
testFile="/build/christian/tmp/space file"

# Ensure the file is present. Works with both versions of the files.
if [ ! -f "$testFile" ]
then
  echo "Test file not found. Exiting."
  exit 1
fi
echo "Test file is present. Continuing program."

# Test the age of the file and only perform an operation
# if the file is more than 18 hours old.
if [ "$( find "$testFile" -mmin +1080 )" != "" ]
then
  echo "File is more than 18 hours old. Continuing with program."
else
  echo "No action will be performed based on the file age."
  exit 1
fi
echo "Performing action on the file."
_________________________
Christian
#40104192 120Gb (no longer in my E36 M3, won't fit the E46 M3)