Guest User

Untitled

a guest
Jan 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. let cmd = "ps h --ppid " . getpid() . " -o pid,cmd"
  2. let childs = map(filter(systemlist(cmd), 'v:val !~ "ps h --ppid "'), '{ "pid":matchstr(v:val, "^\d*"), "cmd":matchstr(v:val, " \@<=.*$")}')
  3. echo childs
  4.  
  5. [{'cmd': 'python', 'pid': '24173'}]
  6.  
  7. [
  8. {
  9. 'pid': '24173',
  10. 'cmd': 'python'
  11. }
  12. ]
  13.  
  14. [{'cmd': 'python', 'pid': '24173'}, {'cmd': '/bin/bash', 'pid': '32368'}]
Add Comment
Please, Sign In to add comment