Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with arrays -- "unknown file attribute"
- X-seq: zsh-users 13637
- 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 03:27:24 -0500 (EST)
- In-reply-to: <b11ea23c0901050004h4f1825egc01d39c1f74c0ef0@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <b11ea23c0901050004h4f1825egc01d39c1f74c0ef0@xxxxxxxxxxxxxx>
On Mon, 5 Jan 2009, Webb Sprague wrote:
Hi zsh list again,
I have a problem converting a whitespace string to an array. See XXX in
code below (which takes the list of tables generated by sqlite and tries
to parse and iterate over them). Everything I try to go from text to
array either doesn't convert to an array or gives some funky error.
Please help, before I revert to my old bash ways !!
pop-colnames () {
IFS=
setopt errreturn
TABS=( $(sqlite3 $DB .tables) ) # XXX
The following should work:
...
TABS=( ${=$(sqlite3 $DB .tables)} )
for TAB in $TABS ; do
...
${=...} turns on SH_WORD_SPLIT. And, I think the parentheses around $TABS
was the cause of the odd error message.
Note that this'll fail if tables contain spaces in their names. (Which is
kind of pathological, but possible in SQLite.) I tried adding the '-line'
option to sqlite3, but the output was unchanged.
Best,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author