bash: set - Make functions or variable always export.



  • Take into account the main readme for this section. README first.

    Using set -a in a script or command line will cause a function or variable to export automatically and be available for subsequent commands.

    Description of set -a: Mark variables which are modified or created for export.

    Check if variable FRUIT exists.

    $  env | grep FRUIT
    

    Make variable export automatically. export command not used.

    $ set -a
    $ FRUIT=apple
    $  env | grep FRUIT
    FRUIT=apple
    

Log in to reply
 

© Lightnetics 2024