Re: [dev] Why not use the -exec feature of find?

From: Nikita Zlobin <nick87720z_AT_gmail.com>
Date: Sat, 3 Jul 2021 12:04:42 +0500

In Sat, 03 Jul 2021 06:52:54 +0300
Greg Minshall <minshall_AT_umich.edu> wrote:

Well, now there is one difference to implement in suckless find
implementation: no need for -exec...+ option at all (and even all
action arguments, thus implying one additional change for most utils,
will describe below).

All actions could be done by external utilities: delete, exec.
Specially about execdir: obviously, this time find must control
grouping.

To avoid need for internal actions there, options for such print could
be like -printdir and -printdir0 and -printquote.

Simple -printdir would cause special chars like spaces to be escaped.

-printquote would use quoting instead of escaping.

-printdir0 could use double nulls to make line end (are empty filenames
ever allowed?).

Alternatively, there could be find args:
-argend <ch>
-lineend <ch>
with 'lineend' taking effect only if it goes after 'argend'.

Now, about other utils.
All utils, at least for files, could support -stdin option to stay
permanently and process arguments from stdin. This would greatly reduce
overhead from running command. Imho, the very approach with running
command per each arg is not enough suckless. Possible command examples:

stdbuf -oL find ... | rm ...
stdbuf -oL find ... | chown ...

Arguments to be substituted could be specially marked in command line -
I guess, '-' is enough known representation for stdin (or may be "\-",
as e.g. sed does to allow match special chars like "^$?*+." in input
text).
Multiple such args would require same number of args per input line, as
for mv, cp, ln.
Received on Sat Jul 03 2021 - 09:04:42 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 03 2021 - 13:36:07 CEST