Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problem with arrays -- "unknown file attribute"
- X-seq: zsh-users 13645
- From: "Webb Sprague" <webb.sprague@xxxxxxxxx>
- To: gak@xxxxxxxxxxxxxx
- Subject: Re: Problem with arrays -- "unknown file attribute"
- Date: Mon, 5 Jan 2009 09:31:31 -0800
- Cc: zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=BH7JMEHDYik5cCladIOcVOQeeGenBVRvtYbShIdcdbY=; b=roMPg0tp96qvvBCpXRwZp0XQ43bBHTJUObLD/IlTU9sGE4s3YgDcvc/iwhRU3U9HxB /nQKUPpcbtLyViadGAnsEItnMm5+kFedcGCSMqey3MLZPDclHClKlWjocJmg2n0aqeXi tX/TGXyzxPUg4MliKXp9V+EPqtqq5JGyJIdhg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=x7rzXy7YJeRP7w4S+gZm0PIKFb1VuZmqdVI4yZQeJFn0l7mTYtflAFvD1iY85uxElg +/hs8mhtFMCGellNnXErKcEi4gOfMig+9wlfymtky6t3SgZXxdWCz1M/3j9CVnyWAl78 mT+lD6OVPtErLF4guhSdBd7Kn7F8rbx4owXbQ=
- In-reply-to: <m3fxjxenta.fsf@xxxxxxxxxxxxxx>
- 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> <m3fxjxenta.fsf@xxxxxxxxxxxxxx>
> So doesn't that just mean you need space *and* newline in IFS?
Yes, it does. I had thought that multiple characters in IFS would
logically "and" together, rather than "or"
>
> I think you should also be able to use:
>
> TABS=(${(ps:\n: :)"$(sqlite3 $DB .tables)"})
Hehe... I can't say that really appeals to me in terms of grace and
simplicity....
> Either way, you'll have a problem if table names contain spaces.
I would have a bigger problem if I wrote databases with tables that
contain spaces... Not that it doesn't happen...
Here is the (so far) working function:
pop-colnames () {
local IFS=$' \t\n' # both spaces
setopt errreturn
TABS=($(sqlite3 $DB .tables))
for TAB in $TABS; do
echo \"$TAB\"
for COL in $COLS; do
echo $COL
#sqlite3 $DB "insert into row_meta (tname, colname) values
($TAB, ${COL//\"/});"
done
done
}
Thanks everyone!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author