From: Pádraig Brady
Date: Tue, 3 Nov 2015 10:13:11 +0000 (+0000) Subject: ls: document and test new shell-escape quoting X-Git-Tag: v8.25~98 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7549be4af7e8ac9a088927c35a011da835968b9f;p=thirdparty%2Fcoreutils.git ls: document and test new shell-escape quoting * 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' --- diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 270e6a67aa..177379b381 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -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 diff --git a/src/ls.c b/src/ls.c index 95a2ed8ec3..8d68a03e11 100644 --- 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\ diff --git a/tests/misc/ls-misc.pl b/tests/misc/ls-misc.pl index 007e25787a..8b97c50f0b 100755 --- a/tests/misc/ls-misc.pl +++ b/tests/misc/ls-misc.pl @@ -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',