[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

Am Sa, den 12.06.2004 schrieb clemens 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 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 

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]