In Bash, the export command is used to make a shell variable available to child processes. When a variable is exported, it becomes part of the environment that is inherited by any new processes launched from the current shell.
Syntax:
To export an existing variable:
Code

export VARIABLE_NAME

To define and export a variable in one step:
Code

export VARIABLE_NAME="value"

Explanation:

   Local vs. Exported Variables:
   Variables defined without export are local to the current shell process and are not accessible by child processes. Exported variables, on the other hand, are placed in the shell's environment, making them accessible to any programs or scripts executed from that shell.
   Child Processes:
   When you run a command or script from your current shell, that command or script executes as a child process. Exported variables are passed down to these child processes, allowing them to access and utilize the variable's value.

Example:
Define a local variable.
Code

  my_local_var="Hello"

If you then run a script, my_local_var will not be available within that script. Define and export a variable.
Code

  export my_exported_var="World"

Now, if you run a script, my_exported_var will be available within that script.
To view all exported variables:
You can use the export command without any arguments or the env command:
Code

export
# or
env