[Top][All Lists]

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

Expanding an undefined array

From: Bernd Eggink
Subject: Expanding an undefined array
Date: Wed, 24 Sep 2008 23:33:19 +0200
User-agent: Thunderbird (X11/20080707)

Is the following difference intentional, a bug, or do I miss something?

  unset a
  set -- "address@hidden"
  echo $#

Output: 0

  typeset a
  set -- "address@hidden"
  echo $#

Output: 1

The man page says, "If the word is double-quoted, ... address@hidden expands each element of name to a separate word. When there are no array members, address@hidden 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'.


Bernd Eggink

reply via email to

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