Monday, May 24, 2010

How to set permanent environment variables from shell script in UNIX?

I have a UNIX shell script that needs to set environment variables, and those variables need to be available permanently after finishing the script execution. I searched a lot for a resolution with no luck!.





How can I do that?

How to set permanent environment variables from shell script in UNIX?
1) You CAN use .profile file under your home directory.





2) You can set the environment variables in:





If you are using ksh ( Korn Shell ) , then in .kshrc


csh ( C Shell ) , then in .cshrc





3) Use appropriate commands for different shells:


set or setenv ( within the .profile or .kshrc or .cshrc )





4) If its different shell ( for eg. bash , tcsh , etc ; then check the


man pages =%26gt; $man tcsh )





5) You may also check these files: .login


.logout








hth





VETRI





Software Engineering Consultant - ( IBM Rational Tools %26amp; Open Source Tools)





Global Software Engineering ( GSE )


Singapore





Vetri AT Global-Software-Engineering DOT com
Reply:chekc the .profile file in u home directory.


or for temporary purpose u can use export command


No comments:

Post a Comment