[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assignments preceding "declare" affect brace and pathname expansion.
From: |
Dan Douglas |
Subject: |
Re: Assignments preceding "declare" affect brace and pathname expansion. |
Date: |
Thu, 28 Mar 2013 00:05:01 -0500 |
User-agent: |
KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; ) |
On Tuesday, March 26, 2013 08:33:52 PM Chet Ramey wrote:
Thank you. I'm familiar with the declaration commands. It's issue 7, not TC1.
> arguments are expanded as normal and then treated as the command
> does its arguments.
Are you saying here that even when a declaration command is _not_ identified,
that it's still correct for word expansions to not follow the usual rules for
regular non-declaration commands?
Hopefully my examples were clear. What I don't understand is this:
# This is correctly recognized
$ touch 'a=( x )'
$ declare a=( * )
$ echo "$a"
a=( x )
# This should either be like above, or fail as below.
$ _= declare a=( * )
$ echo "$a"
( x )
# This does what I expect for unrecognized declaration commands.
$ cmd=declare
$ "$cmd" a=( * ); echo "$a"
-bash: syntax error near unexpected token `('
If it's true that an assignment prefix causes bash to not recognize
declaration commands (which is unfortunate IMO), then you would expect the 2nd
case above to be the same as the 3rd case. Instead, it's not wordsplitting and
not failing due to the () metacharacters, and using sort of a hybrid of the
two.
--
Dan Douglas