FG
💻 Software

Difference between "a=b" and "export a=b" in bash

Fresh5 days ago
Mar 15, 202614359 views
Confidence Score1%
1%

Problem

What's the difference between: and In bash? I understand that they both define environment variables, but I don't fully understand the difference.

Error Output

a=b

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Difference between "a=b" and "export a=b" in bash

Low Risk

propagates the variable to subprocesses. For example, if you did then a subprocess that checked for FOO wouldn't find the variable whereas would allow the subprocess to find it. But if has already been defined as an environment variable, then will modify the value of that environment variable. For example: Older shells didn't support the syntax; you had to write .

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment