where a variable is stored in linux
hi all...
If i declare a variable vech=bus in terminal then i will execute export vech...i want to know where this variable is stored...... can anyone please help me..... thanks in advance |
They are stored in the memory allocated by a process. Environment variables are inherited by child processes and they are destroyed when the parent dies. What is the scope of this question?
|
i want to delete the variable declared...
|
use the unset command
You usually don't need to worry about shell variables (at least in the storage sense, for they are so tiny), but just in case; the "declare" command shows you all the variables in your shell, if you use autocompletion the list will be huge. And in order to delete a variable you can use the "unset" command.
More about unset here-> http://linux.about.com/library/cmd/blcmdln_unset.htm |
Yes. unset should do the trick.
|
^ does this do anything:
Code:
var=5555 |
Quote:
|
where this declare file is stored in the system ...
|
What do you mean by where? What kind of answer are you looking for? A variable (in your shell, as you described), is just stored in your shell environment (your memory).
|
Maybe he means in-disk.
These variables are not permanently stored anywhere. You need to declare them each time. However you can use the shell initialization files for that. For example, in bash you could use /etc/profile, ~/.bashrc, ~/.bash_profile and a few others depending on the concrete circumstance when you need that variable to be set. For bash, check the "INVOCATION" section of the bash man page to know more about these rc files. |
Quote:
can you confirm ? |
All times are GMT -5. The time now is 03:39 AM. |