As I was trying to execute a script in a new environment, I came up with this error:
[: 10: -lt: unexpected operator
Here is the painful part of the script:
end=$((SECONDS+60))
while [ $SECONDS -lt $end ];
do
# process some queue...
sleep 5
done
Origin system: Amazon Linux AMI release 2013.09 (cpe:/o:amazon:linux:2013.09:ga)
Destination system: Debian version 6.0.7
I can read that shell / bash / dash versions can vary, but this is still quite obscure to me. I tried to specify the correct shell on the first line of the script:
#! /bin/bash
or
#! /bin/sh
no chance...
I could also find out that users had similar error messages when using operator == instead of =. What would be the correct replacement for -lt then ? Is there any other solutions ? Any hint is warmly welcome !
$SECONDS
actually set to a value?