Skip to content

Instantly share code, notes, and snippets.

@nitingupta910
Last active November 2, 2023 04:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitingupta910/8eef62176c01d3e9f81e6e8528c664a8 to your computer and use it in GitHub Desktop.
Save nitingupta910/8eef62176c01d3e9f81e6e8528c664a8 to your computer and use it in GitHub Desktop.
#!/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
@nitingupta910
Copy link
Author

nitingupta910 commented May 29, 2023

Usage

mkdir ~/zig && cd ~/zig
zig_get.sh

Now either add ~/zig/latest to PATH or symlink ~/zig/latest/zig to a directory already on your PATH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment