Date: Fri, 29 Oct 2021 17:22:44 -0700
From: enh <[email protected]>
Message-ID:
<CAJgzZopRKyFU9akmZ_iD1qHVUnmqK1=O=zyrjcdvqgg6ick...@mail.gmail.com>
| i've seen fuser used in scripts to provide a list of pids to iterate ps or
| kill over,
Written (in the script) how, and with an fuser actually implemented
the way POSIX says to do it??
That spec requires stdout to be just an unseparated list of pids,
no white space, no terminating newline, just digits.
stderr gets the rest of the data.
You only get anything rational if those two are correctly intermixed,
and both are sent to the same output file (no 2>/dev/null to discard
error messages for example, no simple pids=$(fuser ...) with stderr on
stderr of the shell, for errors, and the stdout via the command substitution.
Do the implementations really do all the fflush() calls needed to get
the output sequenced correctly, or perhaps simply set unbuffered mode
on both stdout and stderr, and write a char at a time ?
I really couldn't believe what I was reading when I read the way that
it is defined to work. And that has to be based upon what some real
implementation actually did.
| it's definitely unfortunate that the -k option is not part of POSIX
Sorry, no idea what that is, all I know of fuser is what POSIX says about it.
| _humans_ seem to use lsof instead.
Yes, that I'd understand, I've used that too - though the *BSD's fstat
has similar functionality. I haven't bothered to install lsof on my
current system...
kre