Skip to content

Commit

Permalink
flags
Browse files Browse the repository at this point in the history
added flags
  • Loading branch information
wdmvv committed Feb 5, 2022
1 parent 9e919ca commit 08ec52f
Showing 1 changed file with 45 additions and 3 deletions.
48 changes: 45 additions & 3 deletions minstall.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
read -p "Mindustry version: " ver;
rm -f Mindustry.jar;
wget -q --show-progress https://github.com/Anuken/Mindustry/releases/download/v"$ver"/Mindustry.jar;
#!/bin/bash

cfgsetup()
{
cd ~;
touch .mincfg;
printf "~/Desktop" > .mincfg;
}

hflag()
{
printf "Script that allows you to download any Mindustry version. Flags:\n\t -p - change download path and run\n\t -h - display this message\n\t -d - display download path\nUsage:\n\t./minstall.sh -p [yourpathhere]\n"
}

dflag()
{
cd ~;
echo $(sed '1!d' .mincfg)
}

main()
{
cd ~;
read -p "Mindustry version: " ver;
path=$(sed '1!d' .mincfg)
cd $path;
wget -q --show-progress https://github.com/Anuken/Mindustry/releases/download/v"$ver"/Mindustry.jar;
echo "Downloaded Mindustry v"$ver" at "$path""
}

while getopts "p:hd" opt; do
case $opt in
p) {
if ! [ -f ~/.mincfg ];
then cfgsetup
fi
cd ~;
echo "$OPTARG" > .mincfg;
}
main ;;
h) hflag ;;
d) dflag ;;
*) main
esac
done

0 comments on commit 08ec52f

Please sign in to comment.