bash function/alias question

From: Eric Taylor (et1_at_rocketship1.com)
Date: 06/27/05


Date: Mon, 27 Jun 2005 09:53:03 -0700

I am having a problem with an alias to a function.
The script atest is chmod +x and if run as a "program"
instead of sourced, it fails. Is this a bash bug?

[3320]$ cat atest
#!/bin/bash
alias foo=bar
function afunc
{
    echo "about to invoke alias foo, which should call bar"
    foo aparm
}
function bar
{
    echo "inside function bar parm1 = $1"
}
afunc

[3322]$ ./atest
about to invoke alias foo, which should call bar
./atest: line 6: foo: command not found

[3323]$ . atest
about to invoke alias foo, which should call bar
inside function bar parm1 = aparm