Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Apparently timeout(1) is part of GNU Coreutils. I wasn't sure after reading whether it was part of Bash itself.


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


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).


But also sucks because the g-prefixed versions aren’t installed on Linux systems which means scripts that rely on them are not portable.


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 ...


> It’s a shame we can’t use timeout with until directly

The until keyword is part of the POSIX.2 shell specification, which does not include any sort of timeout functionality. It could be implemented in bash, but it would not be portable to other shells (Debian dash being the main concern).

This is the reason that it is implemented as a separate utility.

Search for "The until loop" below to see the specification.

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...


[flagged]


“These kinds”…? Unnecessary flaming.


Of course I'm very judgemental towards people who ignore the established knowledge of the field and instead rely on social hearsay. Call me old and grumpy.


Not just ignore, but actively avoid it. Many people do not like to read.


To be fair, I presume learning a tool by manual is not very efficient. At least I personally find the manuals of most utilities lacking in detail and it hence difficult to understand what a certain thing is actually doing and how to use it just from reading the manual. Furthermore, reading about functionality feels like a waste of time, when you are not specifically needing it at the moment. I doubt anybody who is fluent in everything Vim has to offer learned that by reading through the manual once or twice.


  Furthermore, reading about functionality feels like a waste of time
yeah, but simplified, this is how you end up with programmers that write an if statement 10 times because they don't know what a for loop is. The waste of time still happens elsewhere.


> I doubt anybody who is fluent in everything Vim has to offer learned that by reading through the manual once or twice.

The vim manual only explains the flags and how/where to access the documentation and tutorial. You don't read it to "become fluent" in using the TUI application, you read it to learn about how to run the program from the commandline.


If you haven’t, look at the FreeBSD man pages, when possible (most things in coreutils). They are infinitely better than the GNU versions.


I recommend OpenBSD man pages as well.

BTW on Linux, I have "man-all" aliased to "man -a", as I want to read all available man pages (e.g. POSIX, GNU, Linux).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: