Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with arrays -- "unknown file attribute"
- X-seq: zsh-users 13640
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Problem with arrays -- "unknown file attribute"
- Date: Mon, 5 Jan 2009 04:19:14 -0500 (EST)
- In-reply-to: <b11ea23c0901050113k5464778ehe480d6425e72f074@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <b11ea23c0901050004h4f1825egc01d39c1f74c0ef0@xxxxxxxxxxxxxx> <alpine.LNX.2.00.0901050308270.17470@xxxxxxxxxxxxxxx> <b11ea23c0901050113k5464778ehe480d6425e72f074@xxxxxxxxxxxxxx>
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