## summary : bash printf example with float rounding ## keywords : bash, printf, compute, @testable ## publish : gist ## authors : David Crosson ## license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) ## id : 1118db89-6fbd-4610-98b2-0374d345d60a ## created-on : 2019-10-16T13:35:40Z ## managed-by : https://github.com/dacr/code-examples-manager ## run-with : sh $file export TOTAL=236 export TOTAL_MN=$(echo "$TOTAL*5" | bc ) export TOTAL_H=$(echo "$TOTAL_MN/60" | bc -l) export TOTAL_D=$(echo "$TOTAL_MN/60/6" | bc -l) export LANG=us export LC_NUMERIC="en_US.UTF-8" printf "Total: %d units, %.1f minutes, %.1f hours, %.1f days\n" $TOTAL $TOTAL_MN $TOTAL_H $TOTAL_D