LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   When to use the set and when to use export command? (https://www.linuxquestions.org/questions/linux-newbie-8/when-to-use-the-set-and-when-to-use-export-command-163632/)

davidas 03-29-2004 01:02 AM

When to use the set and when to use export command?
 
Under what situation do I need to use the set command, the export command or both together?

Thanks!

profjohn 03-29-2004 02:44 AM

In a terminal enter:

man set

and press return. Read all about it, then enter:

man export

and press return.

If you have problem navigating man pages, enter:

man man

and press return.

I think this will answer most of your questions, but answer back if it does not.

|2ainman 03-29-2004 02:48 AM

The set command is used to see or modify environmental variables. These variables control the behavior of the shell. You would use set to change one of these variables. Export is used in scripting to make a variable visible to other processes that are running. If you export a variable that is the same name as one of the variables that the shell uses, then you have in effect changed the value of that variable. Hope that helps.

davidas 03-29-2004 03:17 AM

Thanks for the reply :)

So in effect, set command and export command both allow you to change your environmental variables, but only export command allow the variable to be visible to other running processes?


Quote:

Originally posted by |2ainman
The set command is used to see or modify environmental variables. These variables control the behavior of the shell. You would use set to change one of these variables. Export is used in scripting to make a variable visible to other processes that are running. If you export a variable that is the same name as one of the variables that the shell uses, then you have in effect changed the value of that variable. Hope that helps.

|2ainman 03-29-2004 03:24 AM

i think set effects environmental variables, and export makes them environmental (meaning they can be seen by other processes).

davidas 03-29-2004 04:01 AM

So in order to set my proxy server, which is the right serquence?

export HTTP_PROXY=http://proxy.server.com:8080/
set HTTP_PROXY

or

set HTTP_PROXY
export HTTP_PROXY=http://proxy.server.com:8080/

?

Also, do the settings stay after a reboot?

Thanks again !


Quote:

Originally posted by |2ainman
i think set effects environmental variables, and export makes them environmental (meaning they can be seen by other processes).


All times are GMT -5. The time now is 03:15 PM.