Skip to content

Instantly share code, notes, and snippets.

@szeiger
Created November 7, 2018 14:48
Show Gist options
  • Save szeiger/562d8aa29a9fe599b31bc057d7454806 to your computer and use it in GitHub Desktop.
Save szeiger/562d8aa29a9fe599b31bc057d7454806 to your computer and use it in GitHub Desktop.
Quick & dirty hack to download Scala binaries
#!/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