小数点比较

时间:2018-07-05 11:36:42

标签: bash shell unix

我有一个值

stuckT=6.405

它可以是0.123,空值或任何十进制数字。我只想检查此值是否大于0.5且小于1或大于1。

declare -i stuckT
stuckT=`echo "scale = 3; $qtimee / 3600" | bc -l`
if ( ("$stuckT" -ge .5 )  && ( "$stuckT" -le 1 ) | bc )
then
echo "Message is stuck with $stuckT Min's" |tee -a tmp_Minutes.txt
else
if [ "$( echo "$stuckT > 1" | bc )" ]
then
echo "$q_name is stuck with more than $stuckT Hours" |tee -a tmp_.txt 
fi
echo "No files Stuck with more than half hour."
 fi

出现错误:-

  

306.405:语法错误:无效的算术运算符(错误标记为“ .405”)

0 个答案:

没有答案