[clue] shell scripting Q

Mike Bean beandaemon at gmail.com
Mon Feb 11 15:39:30 MST 2013


Yay!  Thank you Dan!  I'll put a nod to CLUE in the script comments!

Mike


On Mon, Feb 11, 2013 at 3:27 PM, Dan Kulinski <daniel at kulinski.net> wrote:

> When you use single quotes you stop variable expansion.  Try double quotes
> or forcing expansion with scale='2;${total}/60'
>
> Dan
>
>
> On Mon, Feb 11, 2013 at 3:24 PM, Mike Bean <beandaemon at gmail.com> wrote:
>
>> 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
>>
>> _______________________________________________
>> clue mailing list: clue at cluedenver.org
>> For information, account preferences, or to unsubscribe see:
>> http://cluedenver.org/mailman/listinfo/clue
>>
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20130211/671649e0/attachment.html 


More information about the clue mailing list