changing env variables
hi,
I want to know two things: 1.what is the process of changing values of environment variables like we use set $VARIABLE=value. then why we log off?if possible plz explain the steps and why we do so 2.How do I change size of HISTORY?I changed HISTSIZE in /etc/profile to "5",when i execute "history" it shows last "5" commands.I wanted to limit total number of commands in history to be 5. Thanks & regards |
Which shell are you using?
|
I am using bash ,RHEL5
|
The simplest way, if you want to set it just for your users, is to edit the .bashrc file in your home directory, and add the lines to set the variable to this:
Code:
VARIABLE=value |
still not clear :(
|
There are actually separate environment variables for the length of the history list in the shell (HISTSIZE), and the number of commands stored in .bash_history on exit(HISTFILESIZE), so you might want to set both of these. From man bash:
Code:
HISTFILESIZE VARIABLE=value # set the value echo $VARIABLE # access it again To then make a variable into an environment variable, you need to export it (which again uses the name on its own): export VARIABLE To set environment variables permanently for user(s), you can add the assignment and export statements to one of the following files:
Changes might not take effect until you've logged out and in again. Is that any clearer? Rob |
crystal clear :)
thanks |
related question
Lo,
I've go a related question - http://www.linuxquestions.org/questi...ns-4175413246/ . The thing is, how do I change (in my particulare case HISTSIZE and HISTFILESIZE :-) ) to all currently running sessions of a particular (generic) user without actually telling the people using it to do it manually. Can root simply write to /proc/[PID]/environ? Yet I didn't find HISTSIZE in that environ file (how comes?)... Thanks. |
All times are GMT -5. The time now is 10:45 PM. |