[PATCH 14/40] find/find.1: Access ' character portably.

"G. Branden Robinson" <[email protected]> Thu, 13 Nov 2025 10:47:30 -0600
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <20251113164730.wcbw2tgglsor43ko@illithid>
The `\(aq` special character escape sequence is not universally
portable.  Indirect it through a string definition.  (GNU Bash also uses
this technique.[1])

[1] https://github.com/bminor/bash/blob/a8a1c2fac029404d3f42cd39f5a20f24b6e4fe4b/doc/bash.1#L26
---
 find/find.1 | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/find/find.1 b/find/find.1
index 5de8c57e..0cac600a 100644
--- a/find/find.1
+++ b/find/find.1
@@ -2,10 +2,12 @@
 .TH FIND 1 2025-10-12 findutils \" -*- nroff -*-
 .ie \n(.g \{\
 .  ds " \(dq
+.  ds ' \(aq
 .\}
 .el \{\
 .  \" \*" is not usable in macro arguments on AT&T troff.
 .  ds " ""\" two adjacent quotes and no space before this comment
+.  ds ' '
 .\}
 .SH NAME
 find \- search for files in a directory hierarchy
@@ -2345,7 +2347,7 @@ .SS Processing arbitrary starting points
 .nf
 \&
 .in +4n
-.B $ find .\& \-type f \-exec file \(aq{}\(aq \e;
+.B $ find .\& \-type f \-exec file \*'{}\*' \e;
 .in
 \&
 .fi
@@ -2372,14 +2374,14 @@ .SS Traversing the filesystem just once \(en for 2 different actions
 .in +4n
 .B $ find / \e
 .in +4n
-.B \e( \-perm \-4000 \-fprintf /root/suid.txt \(aq%#m %u %p\en\(aq \e) , \e
+.B \e( \-perm \-4000 \-fprintf /root/suid.txt \*'%#m %u %p\en\*' \e) , \e
 .br
-.B \e( \-size +100M \-fprintf /root/big.txt  \(aq%\-10s %p\en\(aq \e)
+.B \e( \-size +100M \-fprintf /root/big.txt  \*'%\-10s %p\en\*' \e)
 .in -4n
 .in -4n
 \&
 .fi
-This example uses the line-continuation character \(aq\e\(aq on the first two
+This example uses the line-continuation character \*'\e\*' on the first two
 lines to instruct the shell to continue reading the command on the next line.
 .
 .SS
@@ -2521,7 +2523,7 @@ .SS Traversing the filesystem just once \(en for 2 different actions
 \&
 .in +4n
 .B $ cd /source-dir
-.B $ find .\& \-name .snapshot \-prune \-o \e( \e! \-name \(aq*~\(aq \-print0 \e) \e
+.B $ find .\& \-name .snapshot \-prune \-o \e( \e! \-name \*'*~\*' \-print0 \e) \e
 .br
 .in +4n
 .B | cpio \-pmd0  /dest-dir
@@ -2561,9 +2563,9 @@ .SS Traversing the filesystem just once \(en for 2 different actions
 .in +4n
 .B $ find repo/ \e
 .in +4n
-.B \e( \-exec test \-d \(aq{}/.svn\(aq \e; \e
-.B \-or \-exec test \-d \(aq{}/.git\(aq \e; \e
-.B \-or \-exec test \-d \(aq{}/CVS\(aq \e; \e
+.B \e( \-exec test \-d \*'{}/.svn\*' \e; \e
+.B \-or \-exec test \-d \*'{}/.git\*' \e; \e
+.B \-or \-exec test \-d \*'{}/CVS\*' \e; \e
 .B \e) \-print \-prune
 .in -4n
 .in -4n
@@ -2813,7 +2815,7 @@ .SS \(lqpaths must precede expression\(rq error message
 to use the pattern with the wildcard during the search for file name matching
 instead of file names expanded by the parent shell:
 .nf
-.B $ find .\& \-name \(aq*.c\(aq \-print
+.B $ find .\& \-name \*'*.c\*' \-print
 .B $ find .\& \-name \e*.c \-print
 .fi
 .
-- 
2.30.2
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmkWC6IACgkQ0Z6cfXEm
bc7yGg//aRx+2qLTY3yQm01rlP6Ps9PEy4aRwasGblW6DHLEzR2DijHesi+JLdrQ
HnB2iruAFSoHvH3nQ62JpjwfA1A6GHbXf4r8wUDcZX69Qm4ojhoPMYWDs0YPLzJj
44paqiYbOno9neCa+3OoRDBa1vp4SqLspUFUEn79qWupHLu4PNVcHGLXhZOmuf1m
CdMwZ8a1Ok252xa84kwlvkE1vl5KBJ721cQ9YK/MehSHgZ7qp2e+2SYXSSQTvKCd
r56xpn8gzg1vModP4NdVscN60kR8yg27qfz6bsOsZnzabdgHP1jk53a5fGeMhMnX
y3c+WWwcnpiIxhhKbC0XUS+6fhY43B7zwGqt0WV6uAh2cjMt26AEW+A/2PUvDrb0
rcafAsoIESvQ1ZkqLV+CChYSAMNCzQfz4CmadY4veQdxgWld4JL/V+JT3mKuYoW4
aBCX0zSBCQvtEX498+mqFgB+V6mK057HEj9ncTTHovINHuxpOWloyAHIfmOb4HPR
0TFD5JrogHTXCoF6S5OxgYyTp/8ByyL4hIa3/8kqrvp6E6JYL2kyPgRd1o9nWDIZ
TpcBRrnvyw0CjFhx/S7z3imNNkjH32k7DAPDN8Yg2rYpSTiLS/+tRmWewRJhEue+
RmVOcVa6Yl1ZPepUmRSXupx22oc/JBJllZ9iL11vuIoKJK0Yetc=
=eMBy
-----END PGP SIGNATURE-----