Last active
November 2, 2016 19:07
-
-
Save rbobillot/d0fc4c01cf9ad174d63516ad48187320 to your computer and use it in GitHub Desktop.
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 | |
if [[ $# == 1 ]] | |
then | |
if [[ -f $1 ]] | |
then | |
TEMPLATE_b64='IyEvYmluL3NoCgpNWVNFTEY9YHdoaWNoICIkMCIgMj4vZGV2L251bGxgClsgJD8gLWd0IDAgLWEgLWYgIiQwIiBdICYmIE1ZU0VMRj0iLi8kMCIKamF2YT1qYXZhCmlmIHRlc3QgLW4gIiRKQVZBX0hPTUUiOyB0aGVuCiAgICBqYXZhPSIkSkFWQV9IT01FL2Jpbi9qYXZhIgpmaQpleGVjICIkamF2YSIgJGphdmFfYXJncyAtamFyICRNWVNFTEYgIiRAIgoK' | |
jar_file=$1 | |
exec_file=$(basename `echo $jar_file | rev | cut -d '.' -f2 | rev`) | |
echo $TEMPLATE_b64 | base64 --decode > $exec_file && cat $1 >> $exec_file && chmod +x $exec_file | |
echo -e "$jar_file: \e[92mFile conerted to\e[0m: $exec_file" | |
else | |
echo "Error: $1: No such file or directory" | |
fi | |
else | |
echo "usage: `basename $0` <file_to_convert>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment