How to know who and where a variable is set ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to know who and where a variable is set ?
# 1  
Old 05-18-2011
How to know who and where a variable is set ?

hi,

i'm not a root user and i want to know which user and in which file is loaded a variable seen in the "env" display ?

I will use this variable but i want to be sure that it will be a permanent variable !

i don't see it in my files (.profile , kshrc...) and neither in /etc/profile.

thanks for your help
Christian
# 2  
Old 05-18-2011
depends on the variable name, as some variables are defined by the shell being used. to help isolate what your are describing, let us know your operating system, shell in use and which variable are you concerned about. what do the following report?

Code:
uname
echo $SHELL


Last edited by unxscorob; 05-18-2011 at 08:58 PM.. Reason: verbosity
# 3  
Old 05-19-2011
There is a hierarchy of creating env variables.

AFAIK, it is
/etc/profile
various scripts in /etc/rc2.d
your files.

OK
# 4  
Old 05-19-2011
hi

i was searching for $USER but it seems to be a system variable and a permanent one

my shell is /usr/bin/ksh

thanks for your help
Christian
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Use read to set a variable.

Hi all, I used to set variable by read from keyboard read -p 'Input new value for variable :' var Now I want to pipe from ls and set to var a.txt b.txt c.txt ls | grep a.txt | read var why this cannot set the $var. What is the different between them....:wall: (4 Replies)
Discussion started by: mainsun
4 Replies

2. Shell Programming and Scripting

do you have a better way to set this variable?

greetings, i have a variable $input that i want to use to set $output. $input is /dir/filename.mph and $input is passed to my script that i manipulate it as follows: input=`basename $input`i want the $output to be filename_solved.mph, basically stuffing "_solved" in the filename. here's how i... (2 Replies)
Discussion started by: crimso
2 Replies

3. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

4. Shell Programming and Scripting

if variable is not set then use default value

Hi everybody. I am finishing this program but there is just one detail. I need to define the number of files that have to be deleted in this way MAXFILES=3 ./program 1 2 3 4 if the $# is > MAXFILES then confirm otherwise just delete them. But if i don't define the MAXFILES like ... (1 Reply)
Discussion started by: bartsimpsong
1 Replies

5. Shell Programming and Scripting

How to set value to variable in UNIX

Hi, I am new to UNIX. I wonder how to set value to variable in UNIX.. my code: if ; then EXIST=$a ; else EXIST=$b ; fi' echo $EXIST the value of EXIST is empty... Thanks :) (5 Replies)
Discussion started by: suigion
5 Replies

6. Solaris

set environment variable?

I am working with solaris 9 sunBlade150 Box. I Installed a program, need to set the environment variable so that when the executable is entered,it finds the path to the executable. The documentation for the software says: Set the appropriate environment variable: Connect to server failed;... (8 Replies)
Discussion started by: smartgupta
8 Replies

7. Shell Programming and Scripting

global variable not being set

In ksh I thought a global variable was any variable in a script or function that did not have the typeset command. I have a global in my calling script which I increment in a function, but the value does not change in the calling script. Here is the code: function f_open_log { typeset -r... (5 Replies)
Discussion started by: robotball
5 Replies

8. Shell Programming and Scripting

set variable with another variable? c shell

okay, this shouldn't be difficult but I can't figure it out. How can I set a variable with another variable. I have the following: foreach pe ($dir $sp) set tpe = `echo $pe | grep M` if ($tpe == M) then set ${$pe} = M <--- This doesn't work else endif end In this case what... (2 Replies)
Discussion started by: wxornot
2 Replies

9. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

10. Programming

TZ variable set within thread

Hello all, I'm going to be using some of the date functions from time.h to do some time stamping. I will be getting a time and date from the header of a TIFF file. I will need to be able create a time for each time zone in the U.S. The source of the time stamp will be in GMT. What I'd like to do... (2 Replies)
Discussion started by: shldBcding
2 Replies
Login or Register to Ask a Question