#!/bin/bash

if [ -z "$*" ] 
then
  files="$(find /lib) $(find /usr/lib) $(find /usr/local/lib) \
         $(find /bin) $(find /usr/bin) $(find /usr/local/bin) \
         $(find /sbin) $(find /usr/sbin)"
else
  files="$*"
fi

for exe in $files
do
  if [ -x $exe ] && [ -f $exe ]
  then
    if ldd $exe | grep -q "not found" ; then
      pacman -Qo $exe
      ldd $exe | grep "not found"
    fi
  fi
done