Last active
November 2, 2023 04:50
-
-
Save nitingupta910/8eef62176c01d3e9f81e6e8528c664a8 to your computer and use it in GitHub Desktop.
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 | |
Z=$(curl -s https://ziglang.org/download/index.json | jq -r '.master."x86_64-linux".tarball') | |
OUT_DIR=$(echo "$Z" | awk -F "/" '{ print $NF }' | sed 's/.tar.xz//') | |
if [ -d "$OUT_DIR" ]; then | |
echo "Latest Zig already present: $OUT_DIR" | |
else | |
curl -s "$Z" | tar xJf - | |
fi | |
rm -f latest | |
ln -s "$OUT_DIR" latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
Now either add
~/zig/latest
toPATH
or symlink~/zig/latest/zig
to a directory already on yourPATH