The lame, old way: passing in a global variable, setting it in the function, then unsetting it later on.
#!/bin/bash
function foobar() {
eval $1="some return value"
}
function main() {
foobar retval
local var=$retval
unset $retval
}
But now, the new way!
#!/bin/bash
function foobar() {
echo "some return value"
}
function main() {
local var=$(foobar)
}