#!/bin/bash #identify executables #srk private tools start with Upper case alphabet. ignore them progs=$(find . -type f -perm +111 -print | sed 's/..//;/^[A-Z]/d') #----------------------------------------------------------------------- TF="OUT_dependencies.txt" trap "[ -e $TF ] && rm $TF" EXIT #----------------------------------------------------------------------- for i in $progs; do #this is the loop over programs for k in $progs; do #loop over dependencies [ "$i" != "$k" ] && grep -Ho "$i" $k done done | sort -u | grep ":" > $TF #----------------------------------------------------------------------- # pretty print the results #----------------------------------------------------------------------- dline; printf "program:\t needs...\n";dline awk -F: 'NR==1{a=$1;b=$2;next} $1==a{b=b " " $2} $1!=a{print a": "b; a=$1;b=$2} END{print a": "b}' $TF | column -t echo dline; printf "tool:\t used in ...\n"; dline awk -F: '{print $2,$1}' $TF | sort -u | awk \ 'NR==1{a=$1;b=$2;next} $1==a{b=b " " $2} $1!=a{print a": "b; a=$1;b=$2} END{print a": "b}' | column -t