bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor documentation issue: escaping {}


From: Keith Thompson
Subject: Minor documentation issue: escaping {}
Date: Fri, 6 Oct 2023 15:11:04 -0700

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.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]