Unsafe bc Usage #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Line ~258
if (( $(echo "$reweight > 0" | bc -l 2>/dev/null || echo 0) )); then
Issue:
If bc is not installed, falls back to echo 0 which always evaluates to true
Should use bash arithmetic: if (( $(echo "$reweight > 0" | awk '{print ($1 > 0)}') ))
Or better: if $(echo "$reweight > 0.0"