Closed ecshreve closed 8 months ago
Options that come to mind
#!/bin/bash
TIL that's a bashism! I did not know this!
I like portability, but I think I like pipefail protection even more. My preferred solution is to (1) change the shebang line to #!/usr/bin/env bash
(/bin/bash isn't a standardized locationāĀ some systems put it bash in /usr/bin or /usr/local/bin; env will find the correct path), and (2) change the README to call bash by name.
sweet, i can pop those changes into a PR.
The sh -> dash link was a fun bit of reading for sure!
woah thatās crazy. 7 seconds of startup time just from starting bash a lot!
i laughed a little at the response "Your suspicion is entirely correct." might try to work that into some conversations
there is a very subtle difference in the download URL for the latest release, and the url for any other release, noting it here
LATEST RELEASE
https://github.com/amonks/run/releases/latest/download/<archive>
ANY OTHER VERSIONED RELEASE
https://github.com/amonks/run/releases/download/<version>/<archive>
š¢ so this works ONLY for latest
curl -L "https://github.com/amonks/run/releases/latest/download/run_Darwin_arm64.tar.gz"
ā this does not (404)
curl -L "https://github.com/amonks/run/releases/download/latest/run_Darwin_arm64.tar.gz"
ā this does not (404)
curl -L "https://github.com/amonks/run/releases/v1.0.0-beta.27/download/run_Darwin_arm64.tar.gz"
š¢ this works (for all other releases as well)
curl -L "https://github.com/amonks/run/releases/download/v1.0.0-beta.27/run_Darwin_arm64.tar.gz"
I wonder if they added the latest
endpoint more recently, so that folks wouldn't have to hit the releases API in scripts like this. That might explain (1) why it's different and (2) why so many scripts in the wild use the releases API.
Found a small problem with the one liner I added to the readme for the install script. I only tested on osx not linux š¤¦ and turns out the one liner doesn't work on a fresh ubuntu install
trying to run the one liner:
operating system
sh
is actually a symlink todash
which doesn't include the pipefail option optionon ubuntu (and some other distros) sh has the symlink by default: https://en.wikipedia.org/wiki/Almquist_shell#Adoption_in_Debian_and_Ubuntu
Dash Debian: https://manpages.debian.org/bookworm/dash/dash.1.en.html#Argument_List_Processing
GNU Bash: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html