From ade87e07baf2b5315b9e56dadfb26117cc567a95 Mon Sep 17 00:00:00 2001 From: hhvn Date: Sun, 2 Jan 2022 13:36:00 +0000 Subject: parse.y rc.1: support ifs-list with single backtick --- parse.y | 2 ++ rc.1 | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/parse.y b/parse.y index 406faae..1e41465 100644 --- a/parse.y +++ b/parse.y @@ -150,6 +150,8 @@ comword : '$' sword { $$ = mk(nVar,$2); } | FLAT sword { $$ = mk(nFlat, $2); } | '`' sword { $$ = mk(nBackq,nolist,$2); } | '`' brace { $$ = mk(nBackq,nolist,$2); } + | '`' word brace { $$ = mk(nBackq,$2,$3); } + | '`' word sword { $$ = mk(nBackq,$2,$3); } | BACKBACK word brace { $$ = mk(nBackq,$2,$3); } | BACKBACK word sword { $$ = mk(nBackq,$2,$3); } | '(' nlwords ')' { $$ = $2; } diff --git a/rc.1 b/rc.1 index 4da360f..46c337a 100644 --- a/rc.1 +++ b/rc.1 @@ -1220,7 +1220,7 @@ In order to override the value of for a single backquote substitution, use: .Ds -.Cr "\`\` (ifs-list) { command }" +.Cr "\`(ifs-list){ command }" .De .PP .Cr $ifs @@ -1228,7 +1228,7 @@ will be temporarily ignored and the command's output will be split as specified the list following the double backquote. For example: .Ds -.Cr "\`\` ($nl :) {cat /etc/passwd}" +.Cr "\`($nl :){cat /etc/passwd}" .De .PP splits up @@ -1244,7 +1244,7 @@ to contain the newline character, and to contain the tab character. Thus, if you want to process everything in the current directory, but in a random order, you could use: .Ds -.Cr "for (f in \`\` $nl {ls | shuf}) { ... process $f }" +.Cr "for (f in \`$nl{ls | shuf}) { ... process $f }" .De .PP This will correctly handle filenames that contain spaces. -- cgit v1.2.3