Skip to content

Instantly share code, notes, and snippets.

@lizell
Last active December 15, 2015 03:29
Show Gist options
  • Save lizell/5194993 to your computer and use it in GitHub Desktop.
Save lizell/5194993 to your computer and use it in GitHub Desktop.
Small function that can be put in your .bashrc that checks the given paths for jars that exists in both paths. Helpful for e.g. finding jars that exists in both shared lib and webapp lib.
## Checks the given paths for jars that exists in both paths. Helpful
## for e.g. finding jars that exists in both shared lib and webapp lib.
cpdup() {
if [ "$2" = "" ]; then
echo "Usage: cpdup .../WEB-INF/lib .../shared/lib"
else
for JAR in $1/*.jar
do
JAR_FILE=`basename $JAR`
JAR_NAME=${JAR_FILE%-*}
if [ -e $2/$JAR_NAME* ]; then
echo -en "$JAR_NAME:\t$JAR\t"
ls -1 $2/$JAR_NAME*
fi
done
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment