I have a bash function declared like so:
function foo {
echo "this is foo";
}
I didn't call export -f foo, but it still was available in subshells.
However, typically when I declare a function like this instead:
foo(){
echo "this is foo";
}
then I have to call:
export -f foo;
am I imagining things, are is there a difference in export behavior in the different declaration syntax?
Note that I didn't need to export the functions as far as I can tell when I just did:
. my_script_with_foo_in_it.sh # this is in ~/.bash_profile/.bashrc
then later in a bash shell I could call:
foo
without any issue, even without exporting the function.