I wrote a tool for filtering lists of files based on return codes of
subprocesses called "query:"
https://github.com/ericpruitt/query .
Find all dynamically linked executables:
find -type f | query sh -c 'ldd "$QUERY_FILENAME"'
Find all files ending in ".json" that are malformed:
find -type f -iname '*.json' | query -s ! python -m json.tool
The tool should pretty portable. I haven't tested it on FreeBSD or
OpenBSD yet, but I was able to compile it on Mac OS X. I am using
signal(2) whose behavior varies across platforms, but I don't think that
will be a problem in practice since the handler only calls exit(3).
Please let me know what you think of the idea and code.
Thanks,
Eric
Received on Fri May 20 2016 - 02:09:55 CEST