Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: this should be easy variable expansion including globs.
- X-seq: zsh-users 22401
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@xxxxxxxxx>
- Subject: Re: this should be easy variable expansion including globs.
- Date: Wed, 18 Jan 2017 20:20:34 +0000
- Cc: Ray Andrews <rayandrews@xxxxxxxxxxx>, zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= mesmtp; bh=SCfrlJHN5JP4G79nakEChCfgWF4=; b=OMC5pTcLZ0FIOTxPlBWGN XiKvv1zKR7KOosnFQeyuEzZ0gmUt8KjJV3YN0kp6igdQdv5aAeUhQo6QKebthER/ 4k6B9Jq8klzWpeakt3upVdh4FrH2eLcRNdxxqNN5+18ofWnZa4Ffy3dN4UasmrF2 V9OyzOK+3vldPSRS6P1w64=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=SCfrlJHN5JP4G79nakEChCfgWF4=; b=U1Jw6mozGYh+QJgVBxj1 lIAip6CrGAFgcyvWi1+8n3Nj7xyvld0ADKN/z6PsWcMYer2OaZhjALZpV/70qj3u OlR0eHDemXKV5oxS4NMiYnUhHJg5xxFoXcyzDoyQr762BVrZitXFsjJWBniAtHDt 5D+aD8f56iPk+SgHVwNYn5o=
- In-reply-to: <484161484770354__27207.6165573255$1484770824$gmane$org@web26m.yandex.ru>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <52be7a1a-2da8-a4b6-905a-3eea694763c3@eastlink.ca> <20170118184623.3bf91c52@ntlworld.com> <5ade5a22-d115-ed6f-62e2-9d69a9db20d3@eastlink.ca> <484161484770354__27207.6165573255$1484770824$gmane$org@web26m.yandex.ru>
Nikolay Aleksandrovich Pavlov (ZyX) wrote on Wed, Jan 18, 2017 at 23:12:34 +0300:
> Alternative solutions are […] using zsh/parameter module, there will
> be $parameters associative array which may be searched by indexing
> (find `Subscript Flags` section in man pages, though I failed to
> construct a useful subscript) and definitely can be processed in
> a cycle.
% typeset -p ${(k)parameters[(I)SMART*]} >! somefile
1. $parameters is an associative array mapping parameter names to
I don't know what.
2. (I)SMART* causes the parameter expansion to match all key-value pairs
where the key matches "SMART*".
3. (k) means: for each matched pair, the expansion shall contain the
key.
Bug: when there are no variables named SMART*, this will run «typeset
-p» which will output all variables. You could guard against that with
.
local -a names=( ${(k)…} )
(( $#names )) || return 1
-------
Now, having said all that: the Internet says that the smartd(8) man page
documents the available parameters. That isn't the case on my box, but
my smartd(8) might be out of date.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author