Minor documentation issue: escaping {}

Keith Thompson <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <CAAHpriMdy+vLa5zvvT-ZxoifxV_dv+kU1kP4jgBCBV326CyL6w@mail.gmail.com>
As of the latest version of findutils (commit e6e2d10a, Mon 2023-10-02),
the man and info documentation both incorrectly state that {} needs
to be escaped.

In the info documentation, section 3.3.1:
> It replaces the string '{}' by the current file name being processed
> everywhere it occurs in the command.  Both of these constructions need
> to be escaped (with a '\') or quoted to protect them from expansion
> by the shell.

("Both" refers to ';' and '{}'.)

In the man page, under "-exec command ;":
> The string `{}' is replaced by the current file name being processed
> everywhere it occurs in the arguments to the command, not just in
> arguments where it is alone, as in some versions of find.  Both of
> these constructions might need to be escaped (with a `\') or quoted
> to protect them from expansion by the shell.

In the man page, under "-exec command {} +":
> Only one instance of `{}' is allowed within the command, and it must
> appear at the end, immediately before the `+'; it needs to be escaped
> (with a `\') or quoted to protect it from interpretation by the shell.

In the man page, under "-execdir command {} +":
> As with -exec, the {} should be quoted if find is being invoked from
> a shell.

In all the shells I've tried, {} does *not* need to be escaped.
For example, in bash { is treated as a keyword, and is treated
specially only in a context where it's expected.  In other contexts,
it's just an ordinary string.

I've confirmed that `/bin/echo {}` prints `{}` with no diagnostic in
csh, tcsh, bash, ksh, dash, zsh, busybox sh, and fish.

(Escaping it unnecessarily is harmless, so this doesn't cause any
real problems other than encouraging a little extra typing.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.