View Issue Details

IDProjectCategoryView StatusLast Update
00009871003.1(2013)/Issue7+TC1Shell and Utilitiespublic2016-07-14 15:18
Reporterdannyniu Assigned To 
PrioritynormalSeverityCommentTypeEnhancement Request
Status ClosedResolutionRejected 
NameDannyNiu/NJF
Organization
User Reference
Section2.2.3 Quoting
Page Number2320
Line Number73612-73616
Interp Status---
Final Accepted Text
Summary0000987: Add example for quoting within command substitution within double-quotes.
DescriptionI ran into some difficulty using command substitution to obtain filenames for a command to execute, mainly because of the <space> characters in the filenames.

So I sought to quote them, but in my $(cmd), there's also quoting. I thought I had to use backslash inside, which was ugly. But turns out, `$' has special meaning in double quotes, so I didn't have to quote it again.

So I think an example would do a better job explaining this feature.
Desired ActionAdd the following informative text to the end of the section.

When the <double-quote> character is needed within a double-quoted string, it should be escaped by a <backslash> character.

example: foo="my name is \"bar\""

However, since characters enclosed in command substitutions are not affected by double quotes, <double-quote> characters within command substitutions within double-quoted strings do not need to be escaped.

example: myvar="quoted $(command "substitution example")"
TagsNo tags attached.

Activities

Don Cragun

2015-10-08 03:43

manager   bugnote:0002859

The quoting rules for strings inside the $(...) form of command substitution are clearly stated on P2320, L73612-73616 and the Rationale for this section XRAT C.2.2, on P3677, L125674-125685 already contains examples showing how quoting works inside the $(...) form of command substitutions.

Issue History

Date Modified Username Field Change
2015-10-08 03:05 dannyniu New Issue
2015-10-08 03:05 dannyniu Name => DannyNiu/NJF
2015-10-08 03:05 dannyniu Section => "Shell & Utilities" >> "Shell Command Language" >> "Quoting"
2015-10-08 03:05 dannyniu Page Number => new
2015-10-08 03:05 dannyniu Line Number => new
2015-10-08 03:29 Don Cragun Project 2008-TC2 => 1003.1(2013)/Issue7+TC1
2015-10-08 03:43 Don Cragun Section "Shell & Utilities" >> "Shell Command Language" >> "Quoting" => 2.2.3 Quoting
2015-10-08 03:43 Don Cragun Page Number new => 2320
2015-10-08 03:43 Don Cragun Line Number new => 73612-73616
2015-10-08 03:43 Don Cragun Interp Status => ---
2015-10-08 03:43 Don Cragun Note Added: 0002859
2016-07-14 15:18 geoffclare Status New => Closed
2016-07-14 15:18 geoffclare Resolution Open => Rejected