From owner-freebsd-questions@FreeBSD.ORG Wed Apr 21 07:49:02 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4985316A4CE for ; Wed, 21 Apr 2004 07:49:02 -0700 (PDT) Received: from smtp.nildram.co.uk (smtp.nildram.co.uk [195.112.4.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id E671D43D5D for ; Wed, 21 Apr 2004 07:49:01 -0700 (PDT) (envelope-from mark@ukug.uk.freebsd.org) Received: from ukug.uk.freebsd.org (parish.gotadsl.co.uk [62.3.235.43]) by smtp.nildram.co.uk (Postfix) with ESMTP id 7FD192533F3; Wed, 21 Apr 2004 15:48:04 +0100 (BST) Message-ID: <40868978.4050708@ukug.uk.freebsd.org> Date: Wed, 21 Apr 2004 15:47:20 +0100 From: Mark Ovens User-Agent: Mozilla Thunderbird 7.0 (Windows/20040410) X-Accept-Language: en-gb, en-us MIME-Version: 1.0 To: Ion-Mihai Tetcu , freebsd-questions@freebsd.org References: <20040421170914.5a5204a3@it.buh.cameradicommercio.ro> In-Reply-To: <20040421170914.5a5204a3@it.buh.cameradicommercio.ro> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: why test(1) works with -eq but not -nq ? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2004 14:49:02 -0000 Ion-Mihai Tetcu wrote: > Hi, > > > Could somebody explain me why in the second case I get an error (both > with test(1) and with sh's builtin) ? > > itetcu@it> /var/log/ports [16:51:38] 0 > # sh > # cat ports_sup_log | wc -l > 3 > # if [ "`cat ports_sup_log | wc -l`" -eq "3" ]; then echo 'da'; fi > da > # if [ "`cat ports_sup_log | wc -l`" -nq "3" ]; then echo 'da'; fi > [: 3: unexpected operator > > # if (/bin/test "`cat ports_sup_log | wc -l`" -eq "3") ; then echo 'da'; fi > da > # if (/bin/test "`cat ports_sup_log | wc -l`" -nq "3") ; then echo 'da'; fi > test: 3: unexpected operator > > > The 'not equal' operator (I assume that is what you want) is -ne, not -nq HTH Regards, Mark