Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable value set by shell scripts, search by process id 1

Status
Not open for further replies.

bansalhimanshu

Programmer
Sep 27, 2004
36
US
I want to find out the activities done by a shell script at any particular instance using the values they set for a variable. I have a few processes running and the scripts use a number of variables. I want to see the values set by each of these processes without myself running the processes. I want the values at any particular instance. How can I do this?
 
You might want to consider using something like the syslog facility, and incorporating some debug code into your application to output these values to a logfile that you can do a "tail -f" on....

HTH!
C
 
Take a look at the set -x builtin.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Sorry, this was not what I am looking for. I can find out the variables and the values of the variables of a script if I am the one who executed the script. But now I have a script on which I have no control and I have the process id for this process. Now I want to know the variables and the corresponding values for the variables set by that script in runtime. I think this would involve looking at the shell for that process. Can you please help?
 
It's been a while... been away from unix for a while. There were commands I used to use called fuser and truss

Do a fuser on script.sh

fuser -e script.sh
{PID}
####
{PID}
truss -p ####

Play around with the args with these commands.

Will show at system level what the script is doing.



If this is not what your looking for..nevermind.

 
I have a script on which I have no control
If it's really a script you can at least read it, don't you ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
BSD syntax on Tru64:

ps ewww

Will give you process details and environment that the process is running in.

hth



I love deadlines. I like the whooshing sound they make as they fly by - Douglas Adams
 
Dear mrmac228, are you sure about the command "ps e ps is our normal process specification and what are ewww. Are they the flags? But w is not a valid flag. Please reply.
 
Those are BSD style options. Many implementations of ps take the SVR4 standard options with a - in front, but also understand BSD style options when given without the -
 
The command is as Eric says the flags are:

e - command environment and flags
w - wide output (132 cols) ww - arbitrarily wide (displays all environment)

Possibly a bit too keen to have included a third w.

hth

I love deadlines. I like the whooshing sound they make as they fly by - Douglas Adams
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top