Created
November 7, 2018 14:48
-
-
Save szeiger/562d8aa29a9fe599b31bc057d7454806 to your computer and use it in GitHub Desktop.
Quick & dirty hack to download Scala binaries
This file contains hidden or 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 | |
ver=$1 | |
file=scala-$ver.tgz | |
dir=~/scala/scala-$ver | |
url=https://scala-lang.org/files/archive/$file | |
if [ -d $dir ]; then | |
echo "$dir already exists" | |
else | |
tmp=`mktemp -d` | |
echo "Downloading $url to $tmp/$file..." | |
if curl -f -s $url >$tmp/$file; then | |
echo "Extracting..." | |
(cd $tmp; tar xzf $file; rm $file) | |
extr=`ls -d $tmp/* | head -n 1` | |
extrf=`basename $extr` | |
mv $extr $dir | |
echo "Extracted to $dir" | |
else | |
echo Download failed. | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment