Created
January 6, 2016 16:34
-
-
Save jmurowaniecki/31e3ecd8751471295bdf to your computer and use it in GitHub Desktop.
Script to compare functions
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
#!/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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.