-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpslineage
More file actions
executable file
·36 lines (33 loc) · 826 Bytes
/
pslineage
File metadata and controls
executable file
·36 lines (33 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/zsh
#
# Dublin Core Metadata
DC_title=".sh"
DC_rightsHolder="Steven J. DeRose"
DC_creator="http://viaf.org/viaf/"
DC_type="http://purl.org/dc/dcmitype/Software"
DC_language="bash"
DC_created="2020-12-11"
DC_modified="2020-12-11"
DC_publisher="http://github.com/"
DC_license="https://creativecommons.org/licenses/by-sa/3.0/"
#
# https://superuser.com/questions/150117/
#
if isHelpOption "$1"; then
echo "Shell function ${FUNCNAME[0]}, from $me: "
echo " Show the chain of parent processes, given a pid."
exit
fi
bashPID=$$
if ! [ "$1" ]; then
targetPID=$bashPID
else
targetPID=$1
fi
while [[ $targetPID -gt 0 ]]; do
#echo "Target pid: $targetPID"
par=`ps -p $targetPID -o ppid | tail -n 1`
cmd=`ps -p $targetPID -o command | tail -n 1`
echo "$par: $cmd"
targetPID=$par
done