Skip to content

Instantly share code, notes, and snippets.

@jmurowaniecki
Created January 6, 2016 16:34
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 jmurowaniecki/31e3ecd8751471295bdf to your computer and use it in GitHub Desktop.
Save jmurowaniecki/31e3ecd8751471295bdf to your computer and use it in GitHub Desktop.
Script to compare functions
#!/bin/bash
function is_installed() {
hash $1 2>/dev/null
}
for app in cat grep sed diff; do
if ! is_installed $app; then
echo "Please install $app"
exit -1
fi
done
if [ ${#} -lt 2 ]; then
echo "Use: $0 fileA.php fileB.php"
exit -1
fi
f=function
p="s/.*$f\ \([a-zA-Z0-9_]*\).*/\1/"
diff --suppress-common-lines -y \
<(cat "$1"|grep $f|sed -e "$p") \
<(cat "$2"|grep $f|sed -e "$p")
@githubnando
Copy link

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment