What is the purpose of export command in Linux bash shell?

Hi All,
Initially thanks for joining me in this forum.
My question here is, What is the pupose of using export command in linux,?

By default all user defined variables are local. They are not exported to new processes. Use export command to export variables and functions to child processes. For example define a variable called foo with value bar:

foo="bar"
echo "$foo"

Now start a new bash shell:

bash

Try to print value of foo:

echo "$foo"

You won’t see any output as the variable $foo is not exported to new bash shell or any other process. To make variable know to child processes and other sessions, use the export command:

export foo="bar"
echo "$foo"
bash
echo "$foo"

For more info see:

  1. Export Variables