Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add export statement in a bash_profile file?

Tags:

I'm trying to learn that if I have to add export statement to set a variable in a bash_profile file . How would I do that ? For example if I have to add export AX = 'name' then should I simply write it at the end of file or do I need to write anything else as well

like image 527
Lost Avatar asked Jan 25 '13 15:01

Lost


People also ask

What is export profile in Bash?

When you use export , you are adding the variable to the environment variables list of the shell in which the export command was called and all the environment variables of a shell are passed to the child processes, thats why you can use it.

What is export command in Bash?

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. It does not affect the existing environment variable. Environment variables are set when we open a new shell session.

What is export $path?

The export path is a folder location and a file name. This is where memoQ saves the exported document if you use the Export (stored path) command in the Translations list. To change the export path for a document that is already in the project, use the Change export path window.

Where does Bashrc export to?

Open the . bashrc file in your home directory (for example, /home/your-user-name/. bashrc ) in a text editor. Add export PATH="your-dir:$PATH" to the last line of the file, where your-dir is the directory you want to add.


1 Answers

Simply write export AS='name' anywhere in your ~/.bash_profile file:

# Append to the end of the file $ echo "export AS='name'" >> ~/.bash_profile  # Update shell  $ source ~/.bash_profile 

This first command adds the line you want to the file (or just use a text editor) the second updates the shells with the new variable.

like image 67
Chris Seymour Avatar answered Sep 22 '22 11:09

Chris Seymour