Bug in test [ $n != 0 ]; then

Alexander Dalloz alexander.dalloz at uni-bielefeld.de
Sat Jun 12 17:21:38 UTC 2004


Am Sa, den 12.06.2004 schrieb clemens at dwf.com um 19:07:

> The error is:
>     ./update2.sh: line 126: [: too many arguments
> 
> The line in question is:
>     if [ $n9 -ne 0 ]; then
> 
> I tried ${n9} but got the same error.

It shall really be $n9 - in words: dollar+n+nine?

> I dont see any error, and it has worked up to now, anyone else
> see a problem?

>                                         Reg.Clemens

What you do above is a string comparison which does not work with "-ne".
What exactly shall the "$n" be? Is it a number like 3 and you make it 39
and check whether it is 0? Doubt it. If you just mistyped then I just
can answer

if [ $n -ne 0 ]; then echo foo; fi

simply works as long as $n is a number.

"too many arguments" as error message indicates a syntax error. Look at
the line(s) above line 126. You miss a ";" or have a sign too much.

Alexander


-- 
Alexander Dalloz | Enger, Germany | GPG key 1024D/ED695653 1999-07-13
Fedora GNU/Linux Core 2 (Tettnang) on Athlon CPU kernel 2.6.6-1.427 
Serendipity 19:15:52 up 14:58, 8 users, 0.32, 0.33, 0.34 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20040612/3e3a4b51/attachment-0001.sig>


More information about the fedora-list mailing list