Per the EXAMPLES section in the lsof(8) man page on manpages.ubuntu.com, I should be able to run a command/take action if a process has a file open:
To take action only if a process has
/u/abe/fooopen, use:lsof /u/abe/foo echo "still in use"
When I try this syntax (in repeat mode), it doesn't work:
$ lsof -r /u/abe/foo tput bel lsof: status error on tput: No such file or directory lsof: status error on bel: No such file or directory ======= I reviewed the man page, but it's lengthy and I guess I've overlooked something.
What am I missing?
lsof /u/abe/foo && echo "still in use", and a pre-processing step choked on the&characters. Note that man page EXAMPLES are meant to be just that: examples /illustrations of what the main body of the page says. I see nothing in the page that talks about putting another command on thelsofcommand line. There are references tolsof’s exit status (I concede that they are obscure and cryptic). … (Cont’d)