Mike Frysinger wrote:
> is this a bug or feature ?  i never know with bash :)
> 
> $ echo "HI THERE" > foo
> $ export f=$(<foo)
> $ echo $f
> HI THERE
> $ export v=f
> $ export ${v}=$(<foo)
> $ echo $f
> HI
> $ export ${v}="$(<foo)"
> $ echo $f
> HI THERE

It's a feature.  Since `export' and its sibling builtins essentially take
assignment statements as arguments, the parser looks for arguments to these
builtins that are valid assignment statements and arranges for them to be
expanded as if they preceded a command name.  This makes these builtins
more like statements in the shell grammar, which they may end up being
someday.

This can be fooled if you try hard enough, however, as you discovered. A
word that doesn't appear to be an assignment statement is expanded as
usual.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    [EMAIL PROTECTED]    http://cnswww.cns.cwru.edu/~chet/


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to