Sample Header Ad - 728x90

Is is possible to export all variables obtained from sourcing a file?

8 votes
1 answer
4845 views
Say I have a file called variables.sh that sets two variables. foo=bar bar=foo If I source this file I can use these variables in the current shell, but if I want to use it in a second shell script I would have to export them instead, so the file would have to look like this: export foo=bar export bar=foo It is possible to do some kind of source + export or do I have to change variables.sh so that there is export before every variable is set?
Asked by DisplayName (12016 rep)
Oct 14, 2020, 10:32 PM
Last activity: Jul 7, 2025, 12:39 PM