Last active
May 28, 2021 22:36
-
-
Save thiagokokada/115b2588ff65a48d54b8832488801c92 to your computer and use it in GitHub Desktop.
Script that downloads Babashka if not available and runs the file as a Babashka script afterwards
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
#!/usr/bin/env bash | |
#_( | |
bb_dir="$HOME/.bb" | |
if [ ! -x "$bb_dir/bb" ]; then | |
echo "Babashka not found. Installing it at $bb_dir directory..." | |
download_dir="$(mktemp -d)" | |
trap "rm -rf $download_dir" EXIT | |
curl "https://raw.githubusercontent.com/babashka/babashka/master/install" -Ssqlo "$download_dir/install" | |
mkdir -p "$bb_dir" | |
bash "$download_dir/install" --dir "$bb_dir" --static | |
fi | |
exec "$bb_dir/bb" -f "$0" -- "$@" | |
) | |
(println "Hello World!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice, thanks for this.