On 12:07:46 Nov 21, Ashish Verma wrote: > Hi All, > > I need to set an environment variable. Following is what I did. > > TMPDIRECTORY=/usr/local/tmp_directory > > env |grep TMPDIRECTORY > <blank> > echo $TMPDIRECTORY > /usr/local/tmp_directory > > export TMPDIRECTORY > set |grep TMPDIRECTORY > /usr/local/tmp_directory > > env |grep TMPDIRECTORY > /usr/local/tmp_directory > > > Now I logged off as root as I had su 'ed in and then run the below commands. > Now when I checked in the env of the non root user, the value was not there. > Again I su 'ed and the variable was not set in there either. I need this > variable to stay in the system even after I log off as any user. How can I > make a variable stay. This variable is used in certain scripts to store tmp > content. Please advise.
It is impossible to achieve your goal. The shell is invoked as the user who logs in and variables can only be set by the logic rc scripts. Your question is wrong and consequently your understanding of the way UNIX works is also incorrect. What do you want to achieve? Your scripts should look either for files in /tmp for instance to check for something that persists across logins or if you want the environment approach, then only for variables that are exported into child shells as long as the user does not logout of course. ;) Best of luck! -Girish _______________________________________________ To unsubscribe, email [EMAIL PROTECTED] with "unsubscribe <password> <address>" in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
