From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Lydgate <zsh@lydgate.e4ward.com>, zsh-users@sunsite.dk
Subject: Re: test if a parameter is numeric
Date: Tue, 20 Feb 2007 21:35:56 +0000 [thread overview]
Message-ID: <20070220213556.GB6319@sc.homeunix.net> (raw)
In-Reply-To: <20070220202001.GA6319@sc.homeunix.net>
On Tue, Feb 20, 2007 at 08:20:01PM +0000, Stephane Chazelas wrote:
> On Tue, Feb 20, 2007 at 08:52:26AM +0100, DervishD wrote:
> [...]
> > [[ "$1" == ]]
> >
> > And the "[[" is NOT portable, either, it's a zsh thing (and probably
> > bash has too, I don't know, but AFAIK is not POSIX/SuS).
> [...]
>
> rather from ksh.
>
> POSIXly, you'd write
>
> case $1 in
> ("" | *[!0-9]) echo not a number;;
("" | *[!0-9]*) echo not a number;;
sorry.
[...]
> Note that zsh extended globbing patterns, though with a
> different syntax are functionnaly equivalent to regexps and has
> may additions over it.
>
> ERE -> zsh
> . ?
> * #
> + ##
> ? (|...)
> (...) (...)
> (..|..)(..|..)
[...]
It can also be said of ksh's globs (same as bash with extglob or
zsh with kshglob)
ERE -> ksh
. ?
a* *(a)
a+ +(a)
a? ?(a)
(a|b) @(a|b)
recent versions of ksh have more features. There are features in
ksh globs that are not available in zsh's ones like {3}(...),
and likewise in the other direction like <1-10>.
ksh's @(a*b&*c*) can be written in zsh: a*b~^*c* (and not not),
I don't think bash has an equivalent
--
Stéphane
prev parent reply other threads:[~2007-02-20 21:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-09 17:05 zzapper
2007-02-10 2:29 ` Bart Schaefer
2007-02-10 8:35 ` Stephane Chazelas
2007-02-10 19:22 ` Bart Schaefer
2007-02-10 20:38 ` Stephane Chazelas
2007-02-10 18:13 ` Brian K. White
2007-02-10 18:31 ` Stephane Chazelas
2007-02-11 1:08 ` DervishD
[not found] ` <E1HG3Bl-0007Ge-DM@e4ward.com>
2007-02-20 0:14 ` Lydgate
2007-02-20 3:21 ` Andrew Ruder
[not found] ` <E1HJLZy-0001UA-44@b.e4ward.com>
2007-02-20 3:56 ` zsh
2007-02-20 7:02 ` Com MN PG P E B Consultant 3
2007-02-20 7:52 ` DervishD
2007-02-20 14:35 ` Frank Terbeck
2007-02-20 20:20 ` Stephane Chazelas
2007-02-20 21:35 ` Stephane Chazelas [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=20070220213556.GB6319@sc.homeunix.net \
--to=stephane_chazelas@yahoo.fr \
--cc=zsh-users@sunsite.dk \
--cc=zsh@lydgate.e4ward.com \
/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).