LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to set environment variables (https://www.linuxquestions.org/questions/linux-general-1/how-to-set-environment-variables-191974/)

anjaan 06-10-2004 12:10 PM

How to set environment variables
 
Hi all, I would like to set up an environment variable under SuSe Linux. What would be root's startup file. .profile and .bash_profile don't exist. Any help is appreciated. Thanks.

Dark_Helmet 06-10-2004 12:46 PM

For bash, there primarily four files to look at:
/etc/profile
/etc/bashrc
~/.bash_profile
~/.bashrc

You can modify any of them to export the variable. For the files located in /etc, the changes will be included for every user. For the files in ~/, the chages will only be for that particular user. If the file doesn't exist, just create one adding whatever necesssary commands with a text editor and save it. Then re-log (or source the file) to have the changes take effect.

anjaan 06-10-2004 02:00 PM

Thanks very much :)

One last question. Lets say running some script requires running a variable first. Doest that mean that I need to run that variable (by adding to /etc/profile for example) for crontab as well? Does cron require you to run a variable? Where would I specify the same variable for cron? Thanks in advance

jim mcnamara 06-10-2004 02:04 PM

For cron you may have to declare the variable inside the script you run.


All times are GMT -5. The time now is 10:02 PM.