![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A program to trace execution of another program | jiten_hegde | High Level Programming | 3 | 08-19-2008 02:26 AM |
| returning values from shell script to calling C program | nehamore | Shell Programming and Scripting | 2 | 02-04-2008 08:09 AM |
| Calling SHELL script from C program | Chanakya.m | Shell Programming and Scripting | 7 | 09-21-2007 05:34 PM |
| pass parameter back to calling program | jthomas | Shell Programming and Scripting | 11 | 11-20-2003 05:13 AM |
| Java program calling a UNIX command | QUartz Ite | UNIX for Dummies Questions & Answers | 2 | 11-15-2001 06:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
calling program
hi,
i have a script.sh on my machine and it used in the system but my question is how can i know the program called this script.sh?? i.e. from where it called and execute?? Many thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You want to know which program invoked script.sh? A ps listing will reveal the parent PID. It's possible for the parent to exit before the child does, though; then your process will show as orphaned.
Code:
ps wallx | { head -1; grep 'script\.sh'; }
The head is just to get the explanatory header as well; in a script, you don't want that. Example: Code:
vbvntv$ ps wallx | { head -1; grep to*tem ; }
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
0 1000 9478 1 15 0 113136 30536 - SLl ? 32:30 totem
|
|||
| Google The UNIX and Linux Forums |