[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: excess braces ignored: bug or feature ?
From: |
Chet Ramey |
Subject: |
Re: excess braces ignored: bug or feature ? |
Date: |
Sun, 19 Feb 2012 16:25:46 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 2/17/12 6:22 PM, Dan Douglas wrote:
> My favorite is probably the parser ignoring any valid redirection syntax with
> the special command substitutions.
>
> ~ $ { echo "$({xxxxxxxxxxxxxxxxxxxx}</dev/stdin)"; } <<<'hi'
> hi
Bash does the same thing as ksh93 here, though for the wrong reasons.
I think ksh93 counts an input redirection that saves the file descriptor
into a variable as sufficient to kick in the `equivalent to cat file'
clause.
> ~ $ { echo "$(1111111111111111111111</dev/stdin)"; } <<<'hi'
> hi
This is a bug. It should be a file descriptor out of range error, or
it should treat the string of digits as a word, since the value
exceeds the largest intmax_t.
> That one really is ignored. No variable named xxx... is actually set.
I assume you mean the first one. It doesn't matter whether or not the
variable is set as a side effect of the redirection -- it's in a
subshell and disappears.
Chet
- --
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9BaM4ACgkQu1hp8GTqdKvbMACfYfcdTfKqCrQrygNGq4SU0RCP
LFEAn3p2zlTl0bZueNB5fy8FLNTDa45L
=6ptf
-----END PGP SIGNATURE-----
Re: excess braces ignored: bug or feature ?, Chet Ramey, 2012/02/19