[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: handling of ints/longs
From: |
Chet Ramey |
Subject: |
Re: handling of ints/longs |
Date: |
Thu, 11 Jul 2002 14:23:32 -0400 |
> 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
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/