Skip to content
Advertisement

local variables in linux

When we export a local variable declared within a current shell does it get passed to future sub shells,processes , child processes or future child processes? I was told it get passed to future sub shells. Is it correct?

Advertisement

Answer

This simple test will answer you by itself:

JavaScript

Breaking it down:

No export …

JavaScript

… leads to VAR1 not being defined in the child.

While with export

JavaScript

… leads to VAR1 being defined in the child.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement