From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Mon, 15 Jun 2015 06:14:53 -0700 To: 9fans@9fans.net Message-ID: <7f461b33776ee23f14f4ab31780a3370@brasstown.quanstro.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] inequality testing in shell Topicbox-Message-UUID: 58956534-ead9-11e9-9d60-3106f5b1d025 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