Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Problem with arrays -- "unknown file attribute"



On Mon, 5 Jan 2009, Webb Sprague wrote:

Hi Ben and all,

TABS=( ${=$(sqlite3 $DB .tables)} )
for TAB in $TABS ; do
...


This doesn't work. (Is there a simple way to assign an array, something like "zsplit ARRAYVAR $STRINGVAR"; I had high hopes for "set", but it doesn't split on anything.)

Here is a new function:

pop-colnames () {
   IFS=
   setopt errreturn
   TABS=( ${=$(sqlite3 $DB .tables)} )  # your change
   for TAB in $TABS; do     # no longer a funky error message

It doesn't work because you explicitly set IFS to something that won't split on spaces.

Replace:

IFS=

with:

IFS=' '


[...]

Thanks Ben, for sustaining compulsive shell programmer during a late night (though I am off to sleep...)!

No problem... I'm feeding my own procrastination, too. :-)

Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author