jaygooby / ttfb.sh

Measures time-to-first-byte in seconds, for single or multiple URLs. Can calculate fastest, slowest & median TTFB values, and optionally log all response headers. Uses curl and the calculation `%{time_starttransfer} - %{time_appconnect}` which doesn't include any connection overhead, to better approximate devtool’s TTFB figure.
MIT License
245 stars 40 forks source link

Which has no -s option #2

Closed sweepies closed 5 years ago

sweepies commented 5 years ago

At https://github.com/jaygooby/ttfb.sh/blob/c8088c7f630c053a2d8c2af101e8aaff9c56c72d/ttfb#L65 an invalid -s option for which is specified, and it expectedly complains:

Illegal option -s
Usage: /usr/bin/which [-a] args
You need to have 'curl' installed and in your $PATH

You can see that it doesn't exist on the gnu which man page.

Looks like the intention is for it to be silent, so it can simply be replaced with

which $dependency > /dev/null

which is tested and working.

jaygooby commented 5 years ago

Thanks, yeah. Looks like -s is BSD which specific. Thanks 🎉