Re: shell quoting around script output
- From: Ed Morton <mortonspam@xxxxxxxxx>
- Date: Thu, 12 Jan 2012 18:33:41 -0600
On 1/12/2012 6:23 PM, Kaz Kylheku wrote:
On 2012-01-12, Ed Morton<mortonspam@xxxxxxxxx> wrote:<stuff I already know snipped>Yes, I know but I don't think that answers my question of why this:
$ awk "$(cat<<"end"
BEGIN{ print "Hello World" }
end
)"
behaves like this (double quotes around $(..) replaced by single quotes):
$ awk 'BEGIN{ print "Hello World" }'
The $(...) will take the output of cat (the here document) and turn it into a
one big string, which is prevented from word splitting or globs because it
is in quotes, causing it to be passed to awk as one argument.
Is that the definitive answer then? That the script that is output from $(...) is not subject to word splitting and so is passed to awk as one argument and that is exactly the same behavior as enclosing a script in single quotes?
Or to put it another way, enclosing a script in single quotes works because that prevents word splitting, and using $(...) to generate a script works because that also prevents word splitting. Is that right?
Ed.
.
- Follow-Ups:
- Re: shell quoting around script output
- From: Seebs
- Re: shell quoting around script output
- From: Kaz Kylheku
- Re: shell quoting around script output
- From: Janis Papanagnou
- Re: shell quoting around script output
- References:
- shell quoting around script output
- From: Ed Morton
- Re: shell quoting around script output
- From: Janis Papanagnou
- Re: shell quoting around script output
- From: Ed Morton
- Re: shell quoting around script output
- From: Dave Gibson
- Re: shell quoting around script output
- From: Ed Morton
- Re: shell quoting around script output
- From: Kaz Kylheku
- shell quoting around script output
- Prev by Date: Re: shell quoting around script output
- Next by Date: Re: shell quoting around script output
- Previous by thread: Re: shell quoting around script output
- Next by thread: Re: shell quoting around script output
- Index(es):
Relevant Pages
|