working with a legacy system, here I'm connecting with sqlplus to store the returned value in a variable and its worked fine with me but the problem with compearing with floating values a numeric/floating comparison
and the returned value might be 0.052 or 0.0032 or integer value, as far as I know, Bash doesn't support float comparison also bc does not support in POSIX
isubsCount=$( sqlplus -s user/pass <<-EOF
set pagesize 0;
set feedback off;
set verify off;
set heading off echo off;
select to_char((Max(start_time_timestamp+ (2/24))- p.port_statusmoddat), 999.999) Diff
from test
exit;
EOF )
if [ ${isubsCount%.*} -ge 1 ]; then
echo yes
fi
also i have tried this but it does not work,:
if (( $(echo "$isubsCount >= 1" |bc -l) )); then
echo yes
fi
bc
does not supported in posixbc
is part of the POSIX spec (see here). Are you working in an environment that doesn't have it? Does it haveawk
orperl
? Also, should the title be about "comparison" instead of "compression"?bc
is a mandatory utility so it must exist. If it's somehow missing in a non-standard system then just usedc