bug-bash
[Top][All Lists]
Advanced

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

Re: handling of ints/longs


From: roberto@
Subject: Re: handling of ints/longs
Date: Thu, 11 Jul 2002 14:59:07 -0400 (EDT)

On Thu, 11 Jul 2002, Chet Ramey wrote:

> > p3.ecf% cat stamp1 stamp2
> > 20020710142335
> > 20020710142344
> > p3.ecf% cat stamptest
> > #!/bin/sh
> > let first=`/bin/cat ./stamp1`
> > let second=`/bin/cat ./stamp2`
> >
> > echo stamp1 is $first
> > echo stamp2 is $second
> >
> > if [ $first > $second ]; then
> >         echo $first is greater than $second
> > fi
> > if [ $first < $second ]; then
> >         echo $first is less than $second
> > fi
>
> This really never did what you expected it to.  After running this
> script, I'd expect you to have an empty file named `20020710142344'
> ($second) in the current directory.
>
> The `>' and `<' are redirections, not test/[ operators.  Use -gt or -lt
> or use [[...]] instead of [...].
>
> Chet
>
>

Right you are!  I cut-and-pasted the wrong file in my posting.  The "real"
one did use -gt and -lt but it still didn't work.  But [[...]] does!
Thanks for the tip.  Also thanks to others who replied.

        roberto

---------------------------------------------------------------------
Roberto Mansoni                                   Phone (416)978-5898
Systems Administrator, ECF                        Fax   (416)978-7320
University of Toronto                  email  address@hidden
Toronto, Canada M5S 1A4                   or  address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]