Skip to content

Instantly share code, notes, and snippets.

@mortie
Created September 26, 2017 13:44
Show Gist options
  • Save mortie/045f5b7748bf3ed491fbb4b054df6f92 to your computer and use it in GitHub Desktop.
Save mortie/045f5b7748bf3ed491fbb4b054df6f92 to your computer and use it in GitHub Desktop.
List all .so dependencies recursively
#!/bin/bash
list=""
lsd() {
if echo "$list" | grep -F "$1" >/dev/null; then
return
fi
list=$(printf "%s\n%s" "$list" "$1")
echo "$1"
text=$(ldd "$1" | grep -F '=>')
while read -r dep; do
d=$(echo "$dep" | cut -d'=' -f2 | cut -d' ' -f2)
lsd "$d"
done <<< "$text"
}
for a in "$@"; do
lsd "$a"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment