Difference between revisions of "What is a Subshell?"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | |||
==Exporting Functions and Variables== | ==Exporting Functions and Variables== | ||
A subshell does not inherit a variable's setting. Use the [[export command]] to export variables and functions to subshell: | A subshell does not inherit a variable's setting. Use the [[export command]] to export variables and functions to subshell: | ||
− | <source>WWWJAIL=/apache.jail | + | <source lang="bash">WWWJAIL=/apache.jail |
export $WWWJAIL | export $WWWJAIL | ||
die() { echo "$@"; exit 2; } | die() { echo "$@"; exit 2; } | ||
export -f die</source> | export -f die</source> | ||
[[Category:Catching signals]][[Category:Commands]] | [[Category:Catching signals]][[Category:Commands]] |
Revision as of 20:55, 22 September 2009
Exporting Functions and Variables
A subshell does not inherit a variable's setting. Use the export command to export variables and functions to subshell:
WWWJAIL=/apache.jail
export $WWWJAIL
die() { echo "$@"; exit 2; }
export -f die