Skip to content

Instantly share code, notes, and snippets.

@ahmubashshir
Last active October 30, 2024 15:35
Show Gist options
  • Save ahmubashshir/53f68739b20fd8224b7ec8a0d9232f12 to your computer and use it in GitHub Desktop.
Save ahmubashshir/53f68739b20fd8224b7ec8a0d9232f12 to your computer and use it in GitHub Desktop.
#!/bin/sh
if test "$0" = "sh" && ! tty -s; then
curl --disable -Lso tmate https://gist.github.com/ahmubashshir/53f68739b20fd8224b7ec8a0d9232f12/raw/tmate.sh
chmod +x tmate
./tmate
else
curl --disable -s https://github.com/tmate-io/tmate/releases/latest -w '%{redirect_url}\n' \
| xargs basename \
| xargs -I '{}' echo \
'https://github.com/tmate-io/tmate/releases/download/{}/tmate-{}-static-linux-amd64.tar.xz' \
| xargs -- curl --disable -Ls \
| tar --wildcards -xJOf - '*/tmate' > "$0"
exec "$0"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment