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

9 lines
536 B
Markdown
Raw Normal View History

# exporting.
to make your variable or function available to called programs/functions you need to export them.
```bash
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".
```