How Do I Export a Variable in Unix?

How Do I Export a Variable in Unix?
Contents

To export a environment variable you run the export command while setting the variable. We can view a complete list of exported environment variables by running the export command without any arguments. To view all exported variables in the current shell you use the -p flag with export.

How do I export variables?

The variable’s changed value will be available to child processes. Once export has been set for a variable you must do export -n <var> to remove the property. export will make the variable available to all shells forked from the current shell.

What is Export command in Linux?

The export command is a built-in utility of Linux Bash shell. It is used to ensure the environment variables and functions to be passed to child processes. The export command allows us to update the current session about the changes that have been made to the exported variable. …

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.