The syntax is kind of oddball, and chances are your interactive script is executed by something like ksh or bash, whereas your script is presumably executed by /bin/sh.
In particular, I imagine the unquoted exclamation mark might have some unseen side effects.
Try fix the find command to adhere to the spec:
Code:
find . -mtime -1 -a \! -name file\*