help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] howto pass bash array to bc


From: Greg Wooledge
Subject: Re: [Help-bash] howto pass bash array to bc
Date: Wed, 8 Aug 2012 13:43:18 -0400
User-agent: Mutt/1.4.2.3i

On Wed, Aug 08, 2012 at 12:38:51PM -0500, address@hidden wrote:
> I know this is not strickly bash but ...
> If I have a bash array, a=("1" "2" "3"), and I want to pass this array to 
> bc for some computations, how do I/can I do this?

You'd need an operator of some kind, not just numbers.  Let's suppose
you want to add them all:

a=(1 2 3)
IFS=+; echo "${a[*]}" | bc; unset IFS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]