#!/bin/bash FILE=$1 bash --show-requires "$FILE" |sort -u |uniq -u > /tmp/showrq.$$ while read LINE ; do # input from looks like this: # executable(chmod) or executable(configure_source) # carve out what's in parentheses DEP=${LINE##*(} DEP=${DEP%)*} case $DEP in *'`') DEP=${DEP//'`'/} esac # If it's in the path it really is a program # --show-requires will also show function names # as being executable if [[ $(which $DEP 2>/dev/null ) ]] ; then echo ${DEP} elif [[ $(grep "$DEP" $FILE |grep '()') ]] ; then case $IGNORE_FUNCTIONS in 1) : ;; *) echo "function $DEP" esac else case $DEP in #*_*) echo "looks like a function" ;; *_*) : ;; *) echo "Unfound $DEP" ;; esac fi done < /tmp/showrq.$$ rm -f /tmp/showrq.$$