notes/scripts/scriptbc
2022-06-09 12:59:03 -07:00

19 lines
312 B
Bash
Executable file

#!/bin/bash
# scriptbc--Wrapper for 'bc' that returns the result of a calculation
# this script was taken from the Wicked Cool Shell Scripts book, page 35
if [ "$1" = "-p" ] ; then
precision=$2
shift 2
else
precision=2 # Default
fi
bc -q -l << EOF
scale=$precision
$*
quit
EOF
exit 0