Skip to content

Instantly share code, notes, and snippets.

@rightson
Created January 9, 2021 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rightson/ed11ebd200b2d4a2228618b78e7f4e0a to your computer and use it in GitHub Desktop.
Save rightson/ed11ebd200b2d4a2228618b78e7f4e0a to your computer and use it in GitHub Desktop.
A function to grep bash function name declared as "function $name () {" pattern
grep_function_names () {
if [ -e "$1" ]; then
grep -E '^function' $1| awk '{print $2}' | sed -r 's/\(|\)|\{|\}//g'
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment