[PATCH 14/42] find.1: access ' character portably
"G. Branden Robinson" <[email protected]> Tue, 18 Nov 2025 21:46:07 -0600
| Newsgroups | gmane.comp.gnu.findutils.bugs |
|---|---|
| Message-ID | <20251119034607.vhlfetejp7z4fdpg@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 c1ad25fc..befc5b27 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
@@ -2340,7 +2342,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
@@ -2367,14 +2369,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
@@ -2516,7 +2518,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
@@ -2556,9 +2558,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
@@ -2816,7 +2818,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----- iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmkdPX8ACgkQ0Z6cfXEm bc4acw/+IDXKxJDsGoBh/a7ErN9BNF1vERLehbYTj2V7kEdcK0410c7LGbVH102t EJX7xIxQuzz1QqLVXuF+ypzDJeLWIcXvDVBugGl4c3BgviMtcFhmkuvni31L+duG /uDf1WUb0BaRTEb3gTQ6q3PauSPv0YKqdGquMicDYtXyCasoOxtHQTnHF1dVv5C8 JkUMygoOm7FQw416+8KhsFNiQ8g+lqW+Mi0vl5zsWiPDuVEh+vyHll4V5R5zE3Ir W2tysd9PHtUNN2xGoRi0m2nKrvPH53VNLXSxMkTsrbdfzN9SEPL9Ur2Ruhx5Rgln pRKfcVNicitQ6ImcKUIHScz3zYs8itRYQIv2bbiMiusIfwsKATprX6AofkjpGMIB dTib1FORhm9QgRA4siJMxJQaean/9zZQqCrxlV858uo25JAqvkUOQP5EMg4j/cmd D4HfkezAL84nIT5Hk2FziFSAUvGJCFS+VRhobPOmwfbs23YM7dsrBVigVsN4pTeV RsB2t6FPwo41cc43FA/qtiIJE/BA6O2BCgo2rArBH6C/cTZ9bDNUbKupX/mnq3hC Xj3vx4MU0uifQK2fWx3ddWBk0Go+UXT0D+lLRD0h2E5WUUuz5XX5KBNS2ZQkpvBD gQe9Z9LT5qHIdzJD6qE40aw3PUx6Iy3tP20K9DnQt/wBjbnX6CM= =QHK/ -----END PGP SIGNATURE-----