[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] Is there a quick way to compute the ratio of two bash arrays
From: |
Peng Yu |
Subject: |
[Help-bash] Is there a quick way to compute the ratio of two bash arrays using bc? |
Date: |
Sat, 8 Aug 2015 15:56:59 -0500 |
Hi, I'd like to compute the ratios of two bash arrays. When there are
just 2 elements in each array, I simply do the following as it is the
quickest to type.
r=(
$(bc -l <<< ${x[0]}/${y[0]})
$(bc -l <<< ${x[1]}/${y[1]})
)
When there are more elements, does anybody has a better way to do it?
--
Regards,
Peng
- [Help-bash] Is there a quick way to compute the ratio of two bash arrays using bc?,
Peng Yu <=