You're quite welcome, for the help.
Regarding the function definition, nope, I meant exactly what I typed. posix sh function definitions do not use the "function" keyword. In shells that do support functions defined using the "function" keyword (e.g. ksh), they behave a bit differently (mostly with respect to positional parameters) than those defined without it.
The space after the opening brace is needed (confirmed in ksh and bash).
Your function definition seems to be some odd hybrid of two different syntaxes. Syntax one (posix-compliant) does not use the "function" keyword and requires parenthesis after the function's name. Syntax two (ksh-style, I presume) uses the "function" keyword and does not require any parenthesis. You are using both the "function" keyword and parenthesis.
What kind of mutant shell are you using?
On an unrelated note, my ksh93 considers "exit" an illegal function name, but bash has no problem with it.
Regards,
Alister