Bernd Eggink wrote:
Is the following difference intentional, a bug, or do I miss something?
unset a
set -- [EMAIL PROTECTED]
echo $#
Output: 0
This is correct.
typeset a
set -- [EMAIL PROTECTED]
echo $#
Output: 1
The question is how to treat the variable created by `typeset'. Bash
has traditionally treated `typeset a' as equivalent to `typeset a='
instead of creating a `placeholder' variable that exists in a sort of
limbo. That's different from things like `export a' or `readonly a',
and probably inconsistent enough to be worth changing for bash-4.0.
That's the difference between the examples, not the expansion of
[EMAIL PROTECTED].
Chet
Chet
The man page says, If the word is double-quoted, ... [EMAIL PROTECTED]
expands
each element of name to a separate word. When there are no array
members, [EMAIL PROTECTED] expands to nothing. It doesn't mention a
difference between an empty and an unset variable in this context. As a
quoted 'nothing' normally counts 1 word, the 'nothing' in the first
example appears to be some kind of 'super-nothing'.
Regards,
Bernd
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU[EMAIL PROTECTED]http://cnswww.cns.cwru.edu/~chet/