http://bugs.winehq.org/show_bug.cgi?id=19321
--- Comment #2 from Austin English austinenglish@gmail.com 2009-07-24 13:22:58 --- Created an attachment (id=22577) --> (http://bugs.winehq.org/attachment.cgi?id=22577) patch
Does this help?
Which '!' is it not finding. Try adding 'set -x' to the top of the script and re-run it.