use re use str fn -check {|f| use str var @missings = (try { doas ldd $f 2>/dev/null | grep 'not found' | re:awk {|_ m @_| put $m } } catch e { }) if (> (count $missings) 1) { var p = (tmp E:LC_ALL = C; pacman -Qo $f) printf "%s seem broken: missing %s\n" $p (str:join ', ' $missings) } } fn -check-executable {|f| if ?(test -x $f) { -check $f } } fn -cbin {|| echo (styled 'Searching broken binaries…' bold bright-yellow) doas find /usr/bin -maxdepth 1 -type f 2>/dev/null | each $-check~ } fn -clib {|| echo (styled 'Searching broken libs…' bold bright-yellow) doas find /usr/lib/*.so* -maxdepth 1 -type f 2>/dev/null | each $-check-executable~ } fn -copt {|| echo (styled 'Searching broken binariess in opt…' bold bright-yellow) doas find /opt -maxdepth 3 -type f 2>/dev/null | each $-check-executable~ } edit:add-var check-links~ {|| -cbin -clib -copt }