zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: "Nikolay Aleksandrovich Pavlov (ZyX)" <kp-pav@yandex.ru>
Cc: Ray Andrews <rayandrews@eastlink.ca>, zsh-users@zsh.org
Subject: Re: this should be easy variable expansion including globs.
Date: Wed, 18 Jan 2017 20:20:34 +0000	[thread overview]
Message-ID: <20170118202034.GA7790@fujitsu.shahaf.local2> (raw)
In-Reply-To: <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


      parent reply	other threads:[~2017-01-18 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 16:13 Ray Andrews
2017-01-18 18:46 ` Peter Stephenson
2017-01-18 19:51   ` Ray Andrews
2017-01-18 20:12     ` Nikolay Aleksandrovich Pavlov (ZyX)
2017-01-18 20:30       ` Ray Andrews
     [not found]     ` <484161484770354__27207.6165573255$1484770824$gmane$org@web26m.yandex.ru>
2017-01-18 20:20       ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170118202034.GA7790@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=kp-pav@yandex.ru \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).