On Wed, Apr 21, 2004 at 05:09:14PM +0300, 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) ?
> 
> [EMAIL PROTECTED]> /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 test for numeric inequality is '-ne':

    % [ 3 -ne 5 ] && echo yes
    yes
    % /bin/test 3 -ne 5 && echo yes
    yes

        Cheers,

        Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to