BASH Scripting

James Gray james at grayonline.id.au
Mon Jun 27 02:34:51 UTC 2005


On Mon, 27 Jun 2005 07:13 am, Todd Deshane wrote:

> When you want to compare strings use ==
> If you want to compare numbers you the -eq (equal)
> -lt (less than) -le (less than or equal to) .... etc.
>
> so one of your conditions was something like:
>
> $num_tries != $max
> instead it could be
>
> $num_tries -lt $max

<PEDANT>
The translation of "!=" is "not equal" which in bash scripting (comparing 
numbers) is "-ne", as opposed to "-lt" (less than) as stated above.

Although I agree that "-lt" is probably better logic than "-ne" in the case of 
the OP's script. :)
</PEDANT>

Cheers,

James
-- 
In Brooklyn, we had such great pennant races, it made the World Series
just something that came later.
  -- Walter O'Malley, Dodgers owner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050627/0b63d016/attachment.sig>


More information about the ubuntu-users mailing list