Home > Back-end >  What does set -a "Mark variables which are modified or created for export" actually mean?
What does set -a "Mark variables which are modified or created for export" actually mean?

Time:08-02

The help text for set -a is somewhat cryptic to me, but maybe i just don't understand what bash is doing behind the scenes with variables. Can someone explain why "marking" variables is needed (what are "unmarked" variables)?

CodePudding user response:

My bash man-page uses a slightly different wording for this: Each variable or function that is created or modified is given the export attribute and marked for export to the environment of subsequent commands. This sounds more clear to me. It means:

Each variable you define in your script, is placed in the environment of any child process you create, and each function you define is also available to each bash-child-process you create.

  • Related