Re: bash is not capable of comparing of strings and real numbers

2009-12-11 Thread Stephane Chazelas
2009-12-07, 22:22(+00), pk: > phani krishna jampala wrote: > >> bash is not capable of comparing of strings ( imean interms of lessthan or >> greater than etc) > > It is, if you use [[ ]] > > a="abcd" > b="bcde" > if [[ "$b" > "$a" ]]; then > echo "$b is greater than $a" > fi [...] Or the "["

Re: bash is not capable of comparing of strings and real numbers

2009-12-08 Thread DennisW
On Dec 8, 7:11 am, Greg Wooledge wrote: > On Mon, Dec 07, 2009 at 05:08:02PM -0800, DennisW wrote: > > Since printf understands floats (or acts like it does), you can use it > > plus a little care and luck to do float comparisons in Bash: > > [...] > > $ printf -v a "%08.2f" $a > > $ printf -v b "

Re: bash is not capable of comparing of strings and real numbers

2009-12-08 Thread Greg Wooledge
On Mon, Dec 07, 2009 at 05:08:02PM -0800, DennisW wrote: > Since printf understands floats (or acts like it does), you can use it > plus a little care and luck to do float comparisons in Bash: > [...] > $ printf -v a "%08.2f" $a > $ printf -v b "%08.2f" $b > $ [[ $a < $b ]] && echo true || echo fal

Re: bash is not capable of comparing of strings and real numbers

2009-12-07 Thread DennisW
On Dec 7, 4:22 pm, pk wrote: > phani krishna jampala wrote: > > bash is not capable of comparing of strings ( imean interms of lessthan or > > greater than etc) > > It is, if you use [[  ]] > > a="abcd" > b="bcde" > if [[ "$b" > "$a" ]]; then >   echo "$b is greater than $a" > fi > > > and real nu

Re: bash is not capable of comparing of strings and real numbers

2009-12-07 Thread pk
phani krishna jampala wrote: > bash is not capable of comparing of strings ( imean interms of lessthan or > greater than etc) It is, if you use [[ ]] a="abcd" b="bcde" if [[ "$b" > "$a" ]]; then echo "$b is greater than $a" fi > and real numbers ( the float values). True, but I can't real

bash is not capable of comparing of strings and real numbers

2009-12-07 Thread phani krishna jampala
bash is not capable of comparing of strings ( imean interms of lessthan or greater than etc) and real numbers ( the float values). So can any one please consider and if possible can release solution in current version 4 it self will be more appreciated. Thanks Phani Krishna