[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't find file

From: David
Subject: Re: Can't find file
Date: Sat, 16 Nov 2019 14:32:02 +1100

On Sat, 16 Nov 2019 at 11:05, David Niklas <address@hidden> wrote:

> I'm still a bit curious why printing a quoted filename from awk will not
> work -- even when it has no spaces.
> ls -- $( awk -v z="EXAMPLE" 'BEGIN{ print "\"" z "\"" }' )
> Oh, wait a second. The file names quotes are being treated as part of the
> filename and not being stripped. OTOH: If I don't include quotes
> filenames with spaces cease to work correctly. So why is only partial
> parameter expansion occurring?

Try reading here:
under the heading:
Parameter Expansions
particularly this sentence:
It is vital to understand, however, that Quoting and Escaping are
considered before parameter expansion happens, while Word
Splitting is performed after.
The essential point being that quoting and escaping occur
before most expansions, and word splitting after.

And then for more detail about the various expansions, there is
this sentence from 'man bash':
The order of expansions is: brace expansion; tilde expansion,
parameter and variable expansion, arithmetic expansion, and command
substitution (done in a left-to-right fashion); word splitting; and
pathname expansion.
where "command substitution" means the syntax in your
question:  $(...)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]