From: Pádraig Brady
Date: Tue, 6 Jan 2026 17:24:39 +0000 (+0000) Subject: doc: tr: warn about shell quoting [:classes:] X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3ae4123f9481e5e422399b7208970d521a1af12;p=thirdparty%2Fcoreutils.git doc: tr: warn about shell quoting [:classes:] * src/tr.c (usage): Warn about avoiding shell globbing. * doc/coreutils.texi (character arrays): Likewise. Suggested by Daniel Dallos. --- diff --git a/doc/coreutils.texi b/doc/coreutils.texi index c42d75753d..018dd3af69 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7074,6 +7074,9 @@ which is of no particular use. @end table +Since @samp{[:@var{class}:]} and @samp{[=@var{c}=]} syntax +are similar to shell globbing syntax, all such class arguments should +be quoted appropriately, when running @command{tr} from the shell. @node Translating @subsection Translating diff --git a/src/tr.c b/src/tr.c index 8a184f17a5..051274b382 100644 --- a/src/tr.c +++ b/src/tr.c @@ -342,8 +342,9 @@ Translation occurs if -d is not given and both STRING1 and STRING2 appear.\n\ -t is only significant when translating. ARRAY2 is extended to length of\n\ ARRAY1 by repeating its last character as necessary. Excess characters\n\ of ARRAY2 are ignored. Character classes expand in unspecified order;\n\ -while translating, [:lower:] and [:upper:] may be used in pairs to\n\ +while translating, '[:lower:]' and '[:upper:]' may be used in pairs to\n\ specify case conversion. Squeezing occurs after translation or deletion.\n\ +Arguments like '[...]' should be quoted, to avoid potential shell globbing.\n\ "), stdout); emit_ancillary_info (PROGRAM_NAME); }