Transfer commands in argumets of function - advantage or disadvantage?

We have this script. In many places functions are used for user confirmation before action.

It looks like:

Code:
function answer ()
{
while read response; do
echo
case $response in
    [yY][eE][sS]|[yY])
        $1
        $2
        break
        ;;
    [nN][oO]|[nN])
        $3
        $4
        break
        ;;
        *)
        printf "Please, enter Y(yes) or N(no)! "
esac
done
}

Now, in that very script there is a question:

Code:
[printf "Proceed? [Y/n] "

And then - calling function with arguments:

Code:
answer "$after_version_check_yes" "" "$after_version_check_no" "$after_version_check_exit"

The content of the arguments is stored in variables and it looks like:

Code:
after_version_check_yes="printf Proceeding...\n\n"
after_version_check_no="printf Exiting...\n\n"
after_version_check_exit="exit 1"

There are also "unsafe" commands like break 3 or:

Code:
tomcat_status_kill=". $BASEDIR/bin/NG/tom_kill.sh"

And then tom_kill.sh runs kill PID.

Here is a question: is it an advantage or a disadvantage? Are there some "security" issues using that scheme?
 
Back
Top