Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with arrays -- "unknown file attribute"
- X-seq: zsh-users 13643
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- Subject: Re: Problem with arrays -- "unknown file attribute"
- Date: Mon, 5 Jan 2009 10:35:40 +0000
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <alpine.LNX.2.00.0901050426390.17470@xxxxxxxxxxxxxxx>
- Mail-followup-to: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <b11ea23c0901050004h4f1825egc01d39c1f74c0ef0@xxxxxxxxxxxxxx> <alpine.LNX.2.00.0901050308270.17470@xxxxxxxxxxxxxxx> <20090105092403.GA7733@xxxxxxxxxxxxxxx> <alpine.LNX.2.00.0901050426390.17470@xxxxxxxxxxxxxxx>
On Mon, Jan 05, 2009 at 04:39:18AM -0500, Benjamin R. Haskell wrote:
[...]
>>> ${=...} turns on SH_WORD_SPLIT. And, I think the parentheses around $TABS
>>> was the cause of the odd error message.
>> [...]
>>
>> word splitting is only on for command substitution, it only for parameter
sorry, I actually meant "...is always on for..." as you probably
guessed.
[...]
>> TABS=(${(f)"$(sqlite3 $DB .tables)"})
>>
>
> The ${(f)"$(command stuff)"} idiom is especially useful in general. But, in
> this case, neither of these works, since sqlite3 returns multiple tables
> per line:
>
> $ TABS=($(sqlite3 ~mozprof/formhistory.sqlite .tables)) ; print -l $TABS
> moz_dummy_table moz_formhistory
> $ TABS=(${(f)"$(sqlite3 ~mozprof/formhistory.sqlite .tables)"}) ; print -l
> $TABS
> moz_dummy_table moz_formhistory
> $ unset IFS
> $ TABS=($(sqlite3 ~mozprof/formhistory.sqlite .tables)) ; print -l $TABS
> moz_dummy_table
> moz_formhistory
[...]
Indeed.
I suppose you could do:
sqlite3 ~mozprof/formhistory.sqlite "SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' UNION ALL SELECT name FROM sqlite_temp_master WHERE type IN ('table','view') ORDER BY 1"
But that'd be overkill and probably not portable accross
versions of sqlite...
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author