Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The meaning of export command in Ubuntu [closed]

Tags:

ubuntu

What does export mean in Ubuntu? For example:

export PATH=$PATH:/usr/src/hive/build/dist/bin/ 
like image 320
Baper Avatar asked May 31 '12 21:05

Baper


People also ask

What is the export command used for?

Export is a built-in command of the Bash shell. It is used to mark variables and functions to be passed to child processes. Basically, a variable will be included in child process environments without affecting other environments.

What does export mean in Bash profile?

1. "export" makes the change visible to new programs launched by bash. – Thorbjørn Ravn Andersen.

Is export temporary Linux?

The export command is used to set environment variables on Linux, either temporarily or permanently.

What is export variable in shell script?

A local shell variable is a variable known only to the shell that created it. If you start a new shell, the old shell's variables are unknown to it. If you want the new shells that you open to use the variables from an old shell, export the variables to make them global.


2 Answers

export is a command in the Bash shell language. When used to set a variable, as in your example, the variable (PATH) will be visible ("exported to") any subprocesses started from that instance of Bash. Without the export command, the variable will not exist in the subprocess.

like image 124
Jim Lewis Avatar answered Oct 05 '22 15:10

Jim Lewis


This means, that your path is extended with /usr/src/hive/build/dist/bin/. Normally /usr/bin, /bin, /usr/sbin, etc are "in your path". If you have a programm /bin/sh, you can just type sh to run it. If you have a program in /usr/src/hive/build/dist/bin/appname you can just run appname to execute it.

like image 24
Oliver Avatar answered Oct 05 '22 14:10

Oliver