Skip to content

Instantly share code, notes, and snippets.

@fathonix
Created February 6, 2024 05:00
Show Gist options
  • Save fathonix/0ec0e83e1584c4fda02a2d7f6637478f to your computer and use it in GitHub Desktop.
Save fathonix/0ec0e83e1584c4fda02a2d7f6637478f to your computer and use it in GitHub Desktop.
Print filename that contains the specified symbol
#!/usr/bin/env bash
# findsym.sh - Print filename that contains the specified symbol
# Usage: findsym.sh [symbol] [file ...]
# Licensed under MIT. (c) 2024 Aldo Adirajasa Fathoni
findsym() {
for f in ${@:2}; do
found=$(nm -a "$f" | \grep $1)
if [ $? -eq 0 ]; then
echo ${f}:
echo $found
fi
done
}
findsym $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment