]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: document and test new shell-escape quoting
authorPádraig Brady <P@draigBrady.com>
Tue, 3 Nov 2015 10:13:11 +0000 (10:13 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 4 Nov 2015 23:30:15 +0000 (23:30 +0000)
* doc/coreutils.texi (ls invocation): Describe the new
'shell-escape' and 'shell-escape-always' quoting options.
* src/ls.c (usage): Mention the new quoting options.
* tests/misc/ls-misc.pl: Add a test for 'shell-escape'

doc/coreutils.texi
src/ls.c
tests/misc/ls-misc.pl

index 270e6a67aaf73753dfaf452aef416ac4a9ea83ca..177379b3812a64ad286f0c64a6053ad07dc1c13a 100644 (file)
@@ -7676,6 +7676,12 @@ The quoting is suitable for POSIX-compatible shells like
 like @command{csh}.
 @item shell-always
 Quote strings for the shell, even if they would normally not require quoting.
+@item shell-escape
+Like @samp{shell}, but also quoting non-printable characters using the POSIX
+proposed @samp{$''} syntax suitable for most shells.
+@item shell-escape-always
+Like @samp{shell-escape}, but quote strings even if they would
+normally not require quoting.
 @item c
 Quote strings as for C character string literals, including the
 surrounding double-quote characters; this is the same as the
index 95a2ed8ec3af380337eae93cf8a312e2b579f20a..8d68a03e1173e98e45758d6ac18de467b580d10e 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -4906,8 +4906,8 @@ Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n\
 \n\
   -Q, --quote-name           enclose entry names in double quotes\n\
       --quoting-style=WORD   use quoting style WORD for entry names:\n\
-                               literal, locale, shell, shell-always, c, escape\
-\n\
+                               literal, locale, shell, shell-always,\n\
+                               shell-escape, shell-escape-always, c, escape\n\
 "), stdout);
       fputs (_("\
   -r, --reverse              reverse order while sorting\n\
index 007e25787a196eb3120547a4be3a0c600c2bed42..8b97c50f0b61409e4d0dfca402cf7611e9bd9587 100755 (executable)
@@ -136,6 +136,7 @@ my @Tests =
      ['q-qs-lit', '--quoting=literal',       $q_bell, {OUT => "q\a\n"}],
      ['q-qs-sh', '--quoting=shell',          $q_bell, {OUT => "q\a\n"}],
      ['q-qs-sh-a', '--quoting=shell-always', $q_bell, {OUT => "'q\a'\n"}],
+     ['q-qs-sh-e', '--quoting=shell-escape', $q_bell, {OUT => "'q'\$'\\a'\n"}],
      ['q-qs-c', '--quoting=c',               $q_bell, {OUT => "\"q\\a\"\n"}],
      ['q-qs-esc', '--quoting=escape',        $q_bell, {OUT => "q\\a\n"}],
      ['q-qs-c-1', '--quoting=c',