Example of bc command:
PASS_RATE=`echo "scale=2;(($PASS_main + $PASS_dp) * 100 ) / ($TOTAL_main + $TOTAL_dp) " | bc -l ` ;
"-l": option is to load math routines and perform the arithmetic operations.
scale: is used to specify the no. of significant digits in the output.
Command line options of bc command.
% /usr/bin/bc -h
usage: /usr/bin/bc [options] [file ...]
-h --help print this usage and exit
-i --interactive force interactive mode
-l --mathlib use the predefine math routnes
-q --quiet don't print initial banner
-s --standard non-standard bc constructs are errors
-w --warn warn about non-standard bc constructs
-v --version print version information and exit
No comments:
Post a Comment