set-option

Bash set -o allexport

Marks variables and functions created or modified while enabled for export to subsequent commands. Disabling the option does not remove export attributes already assigned. Avoid exporting confidential values indiscriminately. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): sample.

Formal Syntax & Structure

bash syntaxbash
set -o allexport; set +o allexport

Return Value

exit status

Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.

Working Example

Example Snippetbash
set -o allexportBM_DEMO=sampleset +o allexportbash -c 'printf "%s\n" "$BM_DEMO"'
Bash Reference