export

Official Description

Variable names are marked for automatic export to the environment of subsequently executed commands.

Syntax

export [name[=value ...]]

Options

-p displays variables preceded by export.

Oddities

Similar to typeset -x.

Example

 $ myvar=den # Create local variable $ $ print $myvar # Display contents den $ $ ksh # Create new shell process $ $ print $myvar # Variable myvar is local to parent shell $ $ exit # Back to parent shell $ $ print $myvar # Still available den $ $ export myvar # Make it an environment variable $ $ print $myvar # Looks the same den $ $ ksh # Create new shell $ $ print $myvar # Variable is available den $ $ exit # Exit from child shell $ $ export –p # List exported variables preceded by 'export' export ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.