Skip to content

Instantly share code, notes, and snippets.

@tylermercer
Last active August 13, 2018 20:06
Show Gist options
  • Save tylermercer/7f3553ad66192e3855c2867dc81a8d3e to your computer and use it in GitHub Desktop.
Save tylermercer/7f3553ad66192e3855c2867dc81a8d3e to your computer and use it in GitHub Desktop.
A simple bash script for merging JAR files
#!/bin/bash/
#Based on http://sureshatt.blogspot.com/2012/03/unzip-all-jars-at-once.html
#Command line args are ($1) the directory to pull jars from and ($2)
mkdir unzippedjarfilesthatwillbemerged;
x=0;
ls -1 $1/*.jar > filelist
for filename in `cat filelist`
do
#echo $filename;
unzip -o $filename -d unzippedjarfilesthatwillbemerged;
x=$(( $x + 1 ));
done;
echo $x JARs merged;
jar -cvf $2 -C unzippedjarfilesthatwillbemerged .;
rm -r unzippedjarfilesthatwillbemerged;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment