LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   which file contains shell variables (https://www.linuxquestions.org/questions/linux-newbie-8/which-file-contains-shell-variables-609327/)

babu198649 12-27-2007 01:10 AM

which file contains shell variables
 
hi
which file contains the shell variables.i am using the following distrubution.

[bala@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT 2005 i686 i686 i386 GNU/Linux

Uncle_Theodore 12-27-2007 01:18 AM

Well, first of all, the information you give doesn't say what distro you're using. :)
From Google I can only guess that it's some flavor of RedHat. Then, the place where the shell variables are set depends on the shell. I assume, it's bash. Then, some variables are set in /etc/profile, some come from .bashrc and .bash_profile in your home directory if they are present. You might want to read man bash, the INVOCATION part, it explains the rest.

babu198649 12-27-2007 01:25 AM

thanks

Quote:

From Google I can only guess that it's some flavor of RedHat.
Quote:

I assume, it's bash.

u r assumptions are perfectly right;)

roy_lt_69 12-27-2007 01:27 AM

There is no one file that contains all the shell variables.
But alot of them are set in /etc and its sub-directories, some can also be user specific (ie see ~ hidden files/directories).

Is there a specific variable you are looking for?

babu198649 12-27-2007 01:35 AM

yes
i am looking for the variable "sdf"

joel2001k 12-27-2007 11:40 AM

try

`declare | less`

babu198649 12-28-2007 03:41 AM

Quote:

try

`declare | less`
thats great
where can i find the file which stores all these values

pixellany 12-28-2007 09:16 AM

Use ps -e to get the PID for bash. Then go to /proc/<PID>/ and do "more environ". This LOOKS like a file, but it's not. It is a structure in memory. What you see in /proc is "virtual files" that point to things in RAM.

roy_lt_69 12-30-2007 08:22 PM

Maybe you should run a grep for the variable 'sdf' (what is this variable for anyways?) in /etc, and in your home directory.
But there is no guarantee it is set in those places (or sub-directories).


All times are GMT -5. The time now is 05:57 PM.