Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bash

set

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)?

like image 795
aceton2 Avatar asked Dec 13 '25 22:12

aceton2


1 Answers

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.

like image 170
user1934428 Avatar answered Dec 16 '25 12:12

user1934428



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!