diff --git a/convert_units.sh b/convert_units.sh new file mode 100644 index 0000000..1717975 --- /dev/null +++ b/convert_units.sh @@ -0,0 +1,6 @@ +convu() { + conv=$( units -f ~/.units.bytes $2 $3 | grep / | cut -f 2 -d " " ) + # sometimes the conversion factor is a large number output by + # units in scientific notation so need to convert it to int with printf + echo $(( $1 / $( printf "%.f" $conv ) )) +}