I ran into an issue where bc does not have boolean expressions in the AIX system. Wondering if there is a replacement command so I don't have make my code any longer? This is in a bash script.
Here is what I had:
percent=-0.17
max=0.20
if [[ $(bc <<< "$percent <= $max && $percent >= -$max") -ge 1 ]]; then
echo "Under the $max acceptable buffer: File ACCEPTED"
else
echo "Over the $max acceptable buffer: File REJECTED"
exit 1
fi
This is my output:
++ bc
syntax error on line 1 stdin
+ [[ '' -ge 1 ]]
man awk
? – Tomáš Pospíšek Sep 17 '18 at 18:39awk
is the usual answer here – Jeff Schaller Sep 17 '18 at 19:31awk
. It just gave me more control over the range. This was from @JeffSchaller link – Tags Sep 17 '18 at 23:17