Thanks firstfire!
I wanted to mention, for posterity's sake: when using source, all the variable setting commands will affect your shell, not just the export commands. This can cause problems if you weren't expecting it. In short, you can't have "local" variables in top-level of the script you source.
A way around this is to wrap your entire script in a function call, use the local builtin, and call the function. E.g.,
Code:
# script to be sourced
function main()
{
local foodir=foo # scope limited to function
export PATH=${HOME}/${foodir} # global scope
}
main
If there is a better way to do that, I'd be glad to know.