logoalt Hacker News

hugmynutustoday at 3:29 AM0 repliesview on HN

> Or is it restricted to 0/1/2 by the shell?

It is not. You can use any arbitrary numbers provided they're initialized properly. These values are just file descriptors.

For Example -> https://gist.github.com/valarauca/71b99af82ccbb156e0601c5df8...

I've used (see: example) to handle applications that just dump pointless noise into stdout/stderr, which is only useful when the binary crashes/fails. Provided the error is marked by a non-zero return code, this will then correctly display the stdout/stderr (provided there is <64KiB of it).