I am a beginner in shell scripting. I Have a decimal value and I want to compare it in a if statement. I was trying like this
size1=`${PATH_TO_CLIENT}sqlplus $IMPUSER/$IMPPWD@$ENDPOINT<< EOF | sed -n '/^\s*SIZE_GB$/{n;n;n;p}'
select owner, sum(bytes)/1024/1024/1024 Size_GB from dba_segments where owner = 'XXXXXX' group by owner;
exit;
EOF`
echo "Total data is = ${size1}"
if (($size1 > 7.50 | bc))
then
echo '### THE DATA SIZE IS GREATER THAN 7.5 GB ###'
echo 'Total data is ${size1}'
exit 1
else
echo 'Total data is {$size1}'
echo '### THE DATA SIZE IS OKAY ###'
fi
The output I am getting is
Total data is = 11.2345
./testDelete.sh: line 65: ((: 11.2345 > 7.50 | bc: syntax error: invalid arithmetic operator (error token is ".2345 > 7.50 | bc")
Total data is {$size1}
### THE DATA SIZE IS OKAY ###
So size1 variable is able to store the value but I was not able to compare it. Please can anyone help me with it.