[ale] Bash question...
Ken Alexander
kenry at alexandertech.biz
Mon Jul 23 10:18:10 EDT 2007
My bad. I thought I remembered using real numbers with (( )). I was
wrong, only int's ...
sorry !
On Mon, 2007-07-23 at 09:57 -0400, James P. Kinney III wrote:
> On Mon, 2007-07-23 at 05:51 -0400, Brian J. Dowd wrote:
> > Thanks for the suggestion, Ken.
> > -B
> > > You can use the arithmetic expression operator - (( ))
> > >
> > > if (( $var < -4 )) ; then
>
>
> Hmm. doesn't work for me...
>
> [jkinney at merlin ~]$ bash -version
> GNU bash, version 3.2.9(1)-release (x86_64-redhat-linux-gnu)
> Copyright (C) 2005 Free Software Foundation, Inc.
> [jkinney at merlin ~]$ var=-4.3; if (( $var < -4 )); then echo "less"; else
> echo "more"; fi
> bash: ((: -4.3 < -4 : syntax error: invalid arithmetic operator (error
> token is ".3 < -4 ")
> more
> [jkinney at merlin ~]$
>
>
> Doesn't like the decimal place.
>
> > > ..
> > > fi
> > > On Sun, 2007-07-22 at 10:37 -0400, Dr. Brian J. Dowd wrote:
> > >> The value of $var is -4.865876
> > >>
> > >> if [ $var -lt "-4" ];
> > >>
> > >> throws an "Integer expression expected" error
> > <snip>
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> >
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ale
mailing list