Skip to content

Instantly share code, notes, and snippets.

@braddevans
Created June 24, 2020 01:19
Show Gist options
  • Save braddevans/0e129afb888039154f67f7c62818f6fd to your computer and use it in GitHub Desktop.
Save braddevans/0e129afb888039154f67f7c62818f6fd to your computer and use it in GitHub Desktop.
#!/bin/bash
# shellcheck disable=SC2140
# shellcheck disable=SC2034
# ## Variables ## #
input_file=$1
input_file_name=$(echo "$input_file" | cut -d'.' -f1)
input_file_name_test=$(echo "$input_file" | cut -d'-' -f2)
input_file_name_test_version=$(echo "$input_file" | cut -d'-' -f3 | rev | cut -c5- | rev)
declare -a folders=(
"1122"
"1710"
)
# Example input file name:
# DEV-Towny-1.0.021.jar
# Output:
# Name: Towny
# Version: 1.0.021
# ## functions ## #
echo "======================= Updater =======================";
echo " ";
echo "Updating: ${input_file_name_test}";
echo "Version: $input_file_name_test_version";
echo " ";
echo "In all plugin folders:
[${folders[@]}]";
echo " ";
echo " ";
for i in "${folders[@]}"; do
cp -v $input_file ../${i}/plugins/$input_file
done
echo " ";
echo " ";
echo "======================= Complete =======================";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment