wiki/help/linux/bash/basic/export.md

536 B

exporting.

to make your variable or function available to called programs/functions you need to export them.

var1="foo"     # only visible in your shell, so you can do "echo $var1" but inside echo $var1 is not available - it is evaluated at execution, so it really is calling "echo foo".
export var1    # now $var1 is available inside stuff we call from this shell, but not other instances.
export -f foo1 # this is how you export function. it is helpful i.e. with programs like "parallel" so you can do "parallel foo1".