我是脚本新手。在比较和变量分配中出现错误。
文件cat tmp_queues_entries_in.txt包含多行,如下所示:
transadapt_receive_969,=,444189812719624,1012980.21600
for k in `cat tmp_queues_entries_stuck.txt`
do
q_name=`echo $k |cut -d ',' -f 1|sed -e 's/ //g'`
declare -i qtime=`echo $k |cut -d ',' -f 4|cut -d '.' -f 1|sed -e 's/ //g'`
echo $qtime "Queue Stuck time"
declare -i qtimee=`echo $qtime`
let stuckT=`echo "scale = 3; $qtimee / 3600" | bc -l`
half_hr=0.5
One_hr=1
if ([ $stuckT '>' $half_hr ]| bc -l) && ([ $stuckT '<' $One_hr ]| bc -l)
then
echo "$q_name is stuck with $stuckT Min's" >>tmp_stuck_q_Minutes.txt
else
if [ $( echo "$stuckT > 1" | bc )]
then
echo "$q_name is stuck with more than $stuckT Hours" >> tmp_stuck_q_Hours.txt
fi
done
echo "No files Stuck with more than half hour." | tee -a ${ERROR_L}**
test.sh: line 70: stuckT=281.383: syntax error: invalid arithmetic operator (error token is ".383")
'[' '>' 0.5 ']'
test.sh: line 83: [: >: unary operator expected
(standard_in) 1: syntax error
'[' ']'
echo 'No files Stuck with more than half hour.'