Created
October 9, 2020 03:45
-
-
Save OneCDOnly/f0a756e33d82ede0f2f7de1b0ecdb511 to your computer and use it in GitHub Desktop.
find unused BASH functions in script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
target_pathfile="$1" | |
target_func='' | |
for target_func in $(grep '()$' "$target_pathfile" | grep -v '=\|\$' | sed 's|()||g'); do | |
[[ $(grep -ow "$target_func" < "$target_pathfile" | wc -l) -eq 1 ]] && echo "$target_func()" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment