zsh-users
 help / color / mirror / code / Atom feed
* Check if option given in short notation (e.g. -9) is set
@ 2016-01-26 13:33 Sebastian Gniazdowski
  2016-01-26 13:43 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2016-01-26 13:33 UTC (permalink / raw)
  To: Zsh Users

Hello
[[ -o "-9" ]] doesn't work. Is there any way to check option given in
such format, besides holding an associative array that would assign
long name to each short name?

Best regards,
Sebastian Gniazdowski


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check if option given in short notation (e.g. -9) is set
  2016-01-26 13:33 Check if option given in short notation (e.g. -9) is set Sebastian Gniazdowski
@ 2016-01-26 13:43 ` Peter Stephenson
  2016-01-26 14:32   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2016-01-26 13:43 UTC (permalink / raw)
  To: Zsh Users

On Tue, 26 Jan 2016 14:33:29 +0100
Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:

> Hello
> [[ -o "-9" ]] doesn't work. Is there any way to check option given in
> such format, besides holding an associative array that would assign
> long name to each short name?

I think

[[ -n ${-[(r)9]} ]]

is reliable.  It should reflect all single-letter options, so if it
doesn't that's a bug.

pws


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Check if option given in short notation (e.g. -9) is set
  2016-01-26 13:43 ` Peter Stephenson
@ 2016-01-26 14:32   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Gniazdowski @ 2016-01-26 14:32 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Users

On 26 January 2016 at 14:43, Peter Stephenson <p.stephenson@samsung.com> wrote:
> I think
>
> [[ -n ${-[(r)9]} ]]
>
> is reliable.  It should reflect all single-letter options, so if it
> doesn't that's a bug.

Checked this on 5.0.2, 5.0.8, 5.1 and 5.2, works. Thanks

Best regards,
Sebastian Gniazdowski


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-26 14:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-26 13:33 Check if option given in short notation (e.g. -9) is set Sebastian Gniazdowski
2016-01-26 13:43 ` Peter Stephenson
2016-01-26 14:32   ` Sebastian Gniazdowski

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).