[clue] shell scripting Q

Mike Bean beandaemon at gmail.com
Mon Feb 11 15:24:58 MST 2013


I've got a script I'm trying to finish, the problem in a nutshell however
is that bash appears to treat all arithmatic as real numbers/integers, and
while I don't need accuracy down to the 10th place, down the 2nd place
would be nice.

In my research I found echo 'scale=2;87/60' | bc
which works well, however the problem is I'm not going to know the first
term, I've got to be able to pass it a variable, and all attemptse to date
have resulted in:

bash-4.1$ echo 'scale=2;$total/60' | bc
(standard_in) 1: illegal character: $

(scratches head)

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20130211/43a436ef/attachment.html 


More information about the clue mailing list