From 60ec01326b5ebac366fe0b939262c2bf16de72ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Thu, 16 Oct 2014 23:15:43 +0200 Subject: Enhance check_libs even further --- .zsh/zshfunctions | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.zsh/zshfunctions b/.zsh/zshfunctions index 01e7394..a653ef5 100644 --- a/.zsh/zshfunctions +++ b/.zsh/zshfunctions @@ -32,18 +32,27 @@ check_libs() [Fields Display] Mapping" - for i in $(ps -A -o pid | tail -n +2); do - pmap -q -C<(<<<$pmapc) $i | - grep '(deleted)' | - tr -s ' ' | - cut -d' ' -f3 | - sort -u | - grep -v '\\|\[aio\]\|SYSV0\|\' \ - && - echo ' ↳' $(ps -o 'args=' $i) + local libs found=0 + + for i in $(ps -A -o 'pid='); do + libs=$(pmap -q -C<(<<<$pmapc) $i | + grep '(deleted)' | + grep -v '\\|\[aio\]\|SYSV0\|\' | + tr -s ' ' | + cut -d' ' -f3 | + sort -u) + + if [[ -n $libs ]]; then + (($found)) && echo #newline between entries + + found=1 + + echo $libs + echo ' ↳' $(ps -o 'args=' $i) + fi done - return 0 + return $found } menc() -- cgit v1.2.3