From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] inequality testing in shell
Date: Mon, 15 Jun 2015 06:14:53 -0700 [thread overview]
Message-ID: <7f461b33776ee23f14f4ab31780a3370@brasstown.quanstro.net> (raw)
In-Reply-To: <CAL+bK4M48=+rCFUXgEeWY4p6H1+46v-yZVYGH5-hVkJMfmxpDw@mail.gmail.com>
On Sun Jun 14 14:12:13 PDT 2015, nsajko@gmail.com wrote:
> Why doesn't the plan9 test program have features for checking
> inequalities (i.e. greater than etc.)?
> What do you guys do when you want to test for inequality?
>
> Maybe the most convenient way to do that in the shell would be if I
> made two tiny programs, lt & gt which would check their two arguments.
to be more pedantic than necessary, test is not part of the plan 9 shell.
the ~ operator is the way to test for (string) equality or inequality.
! is shell negation, so for non-negative integral x,
~ $x [1-3] -> x < 4
! ~ $x [1-3] -> x >= 4
the shell doesn't understand numbers.
outside the shell, hoc or awk are alternatives to test
- erik
next prev parent reply other threads:[~2015-06-15 13:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-14 21:08 Neven Sajko
2015-06-14 21:28 ` Kurt H Maier
2015-06-14 22:11 ` Steve Simon
2015-06-15 13:14 ` erik quanstrom [this message]
2015-06-14 22:54 sl
2015-06-14 23:13 ` Neven Sajko
2015-06-14 23:30 ` Steve Simon
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=7f461b33776ee23f14f4ab31780a3370@brasstown.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/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.
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).