#!/bin/sh

# find_missing_libs.sh
# 2015-07-06
# by Gernot Walzl

IFS='
'
for DIR in $(echo $PATH | tr ':' '\n'); do
  for EXE in $(find "$DIR" -type f -executable -maxdepth 1); do
    if file "$EXE" | grep -q 'ELF'; then
      MISSING=$(ldd "$EXE" | grep 'not found')
      if [ ! -z "$MISSING" ]; then
        echo "$EXE:"
        echo "$MISSING"
      fi
    fi
  done
done