EXPORT(1)                  POSIX Programmer's Manual                 EXPORT(1)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       export -- set the export attribute for variables

SSYYNNOOPPSSIISS
       export name[[=_w_o_r_d]]...

       export -p

DDEESSCCRRIIPPTTIIOONN
       The shell shall give the _e_x_p_o_r_t attribute to the variables
       corresponding to the specified _n_a_m_es, which shall cause them to be in
       the environment of subsequently executed commands. If the name of a
       variable is followed by =_w_o_r_d, then the value of that variable shall be
       set to _w_o_r_d.

       The _e_x_p_o_r_t special built-in shall support the Base Definitions volume
       of POSIX.1-2008, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s.

       When --pp is specified, _e_x_p_o_r_t shall write to the standard output the
       names and values of all exported variables, in the following format:

           ""eexxppoorrtt %%ss==%%ss\\nn"",, <<_n_a_m_e>, <_v_a_l_u_e>

       if _n_a_m_e is set, and:

           ""eexxppoorrtt %%ss\\nn"",, <<_n_a_m_e>

       if _n_a_m_e is unset.

       The shell shall format the output, including the proper use of quoting,
       so that it is suitable for reinput to the shell as commands that
       achieve the same exporting results, except:

        1. Read-only variables with values cannot be reset.

        2. Variables that were unset at the time they were output need not be
           reset to the unset state if a value is assigned to the variable
           between the time the state was saved and the time at which the
           saved output is reinput to the shell.

       When no arguments are given, the results are unspecified. If a variable
       assignment precedes the command name of _e_x_p_o_r_t but that variable is not
       also listed as an operand of _e_x_p_o_r_t, then that variable shall be set in
       the current shell execution environment after the completion of the
       _e_x_p_o_r_t command, but it is unspecified whether that variable is marked
       for export.

OOPPTTIIOONNSS
       See the DESCRIPTION.

OOPPEERRAANNDDSS
       See the DESCRIPTION.

SSTTDDIINN
       Not used.

IINNPPUUTT FFIILLEESS
       None.

EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
       None.

AASSYYNNCCHHRROONNOOUUSS EEVVEENNTTSS
       Default.

SSTTDDOOUUTT
       See the DESCRIPTION.

SSTTDDEERRRR SS
       The standard error shall be used only for diagnostic messages.

OOUUTTPPUUTT FFIILLEESS
       None.

EEXXTTEENNDDEEDD DDEESSCCRRIIPPTTIIOONN
       None.

EEXXIITT SSTTAATTUUSS
       Zero.

CCOONNSSEEQQUUEENNCCEESS OOFF EERRRROORRSS
       Default.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

EEXXAAMMPPLLEESS
       Export _P_W_D and _H_O_M_E variables:

           eexxppoorrtt PPWWDD HHOOMMEE

       Set and export the _P_A_T_H variable:

           eexxppoorrtt PPAATTHH==//llooccaall//bbiinn::$$PPAATTHH

       Save and restore all exported variables:

           eexxppoorrtt --pp >> _t_e_m_p_-_f_i_l_e
           unset _a _l_o_t _o_f _v_a_r_i_a_b_l_e_s
           ... _p_r_o_c_e_s_s_i_n_g
           . _t_e_m_p_-_f_i_l_e

RRAATTIIOONNAALLEE
       Some historical shells use the no-argument case as the functional
       equivalent of what is required here with --pp.  This feature was left
       unspecified because it is not historical practice in all shells, and
       some scripts may rely on the now-unspecified results on their
       implementations. Attempts to specify the --pp output as the default case
       were unsuccessful in achieving consensus.  The --pp option was added to
       allow portable access to the values that can be saved and then later
       restored using; for example, a _d_o_t script.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _S_e_c_t_i_o_n _2_._1_4, _S_p_e_c_i_a_l _B_u_i_l_t_-_I_n _U_t_i_l_i_t_i_e_s

       The Base Definitions volume of POSIX.1-2008, _S_e_c_t_i_o_n _1_2_._2, _U_t_i_l_i_t_y
       _S_y_n_t_a_x _G_u_i_d_e_l_i_n_e_s

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                            EXPORT(1)
