BASH Scripting

Todd Deshane deshantm at gmail.com
Mon Jun 27 14:59:42 UTC 2005


On 6/26/05, James Gray <james at grayonline.id.au> wrote:
> 
> 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>


Glad you were pedant on this one, I am not a bash expert
but can usually figure out or look up what I need, wasn't
sure what not equals was, but knew that less than equals
was better logic.


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
> 
> 
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> http://lists.ubuntu.com/mailman/listinfo/ubuntu-users
> 
> 
> 
> Regards,
Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20050627/2eee2b87/attachment.html>


More information about the ubuntu-users mailing list