[TriLUG] OT - script help
rryals at tmio.com
Fri Jul 8 14:24:57 EDT 2005
Ryan Leathers wrote:
>Now there is an idea I hadn't thought of. Tom foolery with strings where one should use integers seems like a bad idea in general though. example:
>if [ "$threshold" \< "$testvariable" ]
> echo "Threshold $threshold is exceeded by value $testvariable" # or whatever
>The obvious problem is that when you compare values in ascii sort order
>10 is less than 5, so you don't get the result you want
>On the other hand, Warren's suggestion to match string length is probably a great way to go so long as the magic threshold value is always the flip from 99 to 100.
Use the -lt, -gt, -eq numeric test operators instead.
More information about the TriLUG