diff options
author | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-02-25 18:21:31 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-02-25 18:21:31 +0100 |
commit | 2c83939a5779bc890fb33ea115a943cba2b1f5e0 (patch) | |
tree | a160c85713d2f7027d9c22cf550ba77e85f99e21 /01_Internal.zsh | |
parent | ae04f9ce9f61f871dc790019f9bd4c2957b49f8f (diff) |
[Env] Process tree checkup to get urxvt/tmux/screen
Diffstat (limited to '01_Internal.zsh')
-rw-r--r-- | 01_Internal.zsh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh index c7297fe..a4bdf43 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -428,3 +428,26 @@ _rehash () } zle -N _rehash + +# Process helper +_process_tree() +{ + for leaf in ${@:-$$} + do + ps -eo pid,ppid,command | awk -v leaf="$leaf" \ + '{ + parent[$1]=$2 ; + command[$1]=$3 ; + } + function print_ancestry(pid) + { + if (pid != 1) { print_ancestry(parent[pid]) ; printf " :: " } + printf command[pid]; + }; + END { + print_ancestry(leaf) + print "" + }' + done +} + |