4 ms·
Some of this looks useful, but a non exhaustive critique - from non expert - of some of the rest: > chronic: runs a command quietly unless it fails Isn't that
by theteapot 5y ago
Some of this looks useful, but a non exhaustive critique - from non expert - of some of the rest:
> chronic: runs a command quietly unless it fails
Isn't that just `command >/dev/null`?
> ifdata: get network interface info without parsing ifconfig output
`ip link show <if>`?
> isutf8: check if a file or standard input is utf-8
`file` for files. For stdin, when is it not utf8 - unless you've got some weird system configuration?
> lckdo: execute a program with a lock held
`flock`?
- compsciphd 5y ago> > chronic: runs a command quietly unless it fails > Isn't that just `command >/dev/null`? no. that just shows your stderr, not stdout if it failed. and you get stderr even if it doesn't fail.
- spr93 5y agoso use '2>&1' to redirect stderr to stdout. new ideas are great. but this isn't a new idea. "run a command silently unless it fails" is basic; it's the sort of thing that should make one think "i should search the shell man pages" rather than "i should roll my own new utility."
- NavinF 5y agoRead his comment again. '2>&1' just redirects stderr.
- ninkendo 5y ago> > chronic: runs a command quietly unless it fails > Isn't that just `command >/dev/null`? Often times you want to run a command silently (like in a build script), but if it fails with a nonzero exit status, you want to then display not only the stderr but the stdout as well. I’ve written makefile hacks in the past that do this to silence overly-chatty compilers where we don’t really care what it’s outputting unless it fails, in which case we want all the output. It would’ve been nice to have this tool at the time to avoid reinventing it.
- arendtio 5y agoI guess that chronic doesn't just show stderr, but also stdout if the command fails. If I am not mistaken, your example would hide the stdout output, even when the command fails.