From owner-freebsd-questions@FreeBSD.ORG Wed Apr 21 07:47:13 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 4B6D616A4CF for ; Wed, 21 Apr 2004 07:47:13 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D45F543D49 for ; Wed, 21 Apr 2004 07:47:12 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i3LElA5N094820; Wed, 21 Apr 2004 09:47:10 -0500 (CDT) (envelope-from dan) Date: Wed, 21 Apr 2004 09:47:10 -0500 From: Dan Nelson To: Ion-Mihai Tetcu Message-ID: <20040421144709.GA61380@dan.emsphone.com> References: <20040421170914.5a5204a3@it.buh.cameradicommercio.ro> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040421170914.5a5204a3@it.buh.cameradicommercio.ro> X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: freebsd-questions@freebsd.org 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:47:13 -0000 In the last episode (Apr 21), Ion-Mihai Tetcu said: > 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 What do you expect -nq to do? The equality tests are -eq (equal) and -ne (not equal). -- Dan Nelson dnelson@allantgroup.com