Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
mdaniel
4 months ago
|
parent
|
context
|
favorite
| on:
TIL: timeout in Bash scripts
Also, watch out because like many things the timeout command and args differs between /usr/bin/timeout or gtimeout in Brew (that's where the "g" prefix comes from). I haven't used BSD in order to know what it's story is
aidenn0
4 months ago
[–]
Prefixing GNU coreutils with "g" is common on most non-Linux Unix systems; it prevents conflicts with the base system (gmake/gtar vs make/tar).
jonhohle
4 months ago
|
parent
[–]
But also sucks because the g-prefixed versions aren’t installed on Linux systems which means scripts that rely on them are not portable.
mdaniel
4 months ago
|
root
|
parent
[–]
Thankfully bash tolerates that, if the script author cares, e.g.
gnu_sed=gsed if ! command -v $gnu_sed; then gnu_sed=$(detector_wizardry) fi $gnu_sed -Ee ...
Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: