unable to exit from a shell script

Hi All,

I am unable to exit from a shell script using the below code:


#!/bin/ksh
passchk()
(
if [ 0 = "$finalresult" ];then
    echo "Password validated"
else
    echo "Wrong password Quiting the application..."
    exit 0#not working
fi
)
passchk

(Note:"finalresult" passed to the passchk function)
How can I rectify this?

Unless ksh has some unusual syntax I haven't seen before, the delimiters around the function body should be curly braces, not round ones. With round parentheses, you are running (and "successfully" exiting) a subshell, leaving the shell which runs the current script unaffected.

Thanks era.
It worked.