<p>I need to set a system environment variable from a Bash script that would be available outside of the current scope.  So you would normally export environment variables like this:</p>
<pre><code>export MY_VAR=/opt/my_var
</code></pre>
<p>But I need the environment variable to be available at a system level though.  Is this possible?</p>

Not really - once you're running in a subprocess you can't affect your parent.
There two possibilities:
Source
the script rather than run it (see
source .
):
```
```
source {script}
```
```
Have the script output the export commands, and eval that:
```
```
eval `bash {script}`
```
```
Or
:
```
```
eval "$(bash script.sh)"
```
```