3 ms·
yeah, I was wondering if there was some reason that something like this wouldn't work: err_f="$(mktemp)" third_f="$(mktemp)" out="$(cmd 2>"$err_f" 3>"$th
by Groxx 5y ago
yeah, I was wondering if there was some reason that something like this wouldn't work:
err_f="$(mktemp)"
third_f="$(mktemp)"
out="$(cmd 2>"$err_f" 3>"$third_f")"
err="$(cat "$err_f")"
third="$(cat "$third_f")"
Seems like that should work fine, and it's not even that odd looking or hard to understand. But I haven't tried, not sure if there's some surprise lurking in the depths of tempfiles or something.
- gpderetta 5y agoNormally I use mkfifo then immediately rm it after opening the file with exec. The fact that there isn't a good way to open an anonymous pipe and get its two file descriptors in bash is very annoying.