Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
Of course it does something, it declares a null string. If you do please "declare |grep var" the variable will still be there. This is very different from "deleting" the variable.
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).
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.
Of course it does something, it declares a null string. If you do please "declare |grep var" the variable will still be there. This is very different from "deleting" the variable.
thanks, my guess is that instead of var taking up 4 bytes it will now take up 1 byte of ram.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.