Thursday, 15 August 2013

Bash script using negative to cycle through

Bash script using negative to cycle through

I'm trying to run a bash script that includes a nested for loop within
which a variable should cycle through negative exponents, viz:
for ABPOW in {-11..-9}
do
ABC = $((10**$ABPOW))
for ABCOEFF in {1..9}
do
sed -e 's/ACOEFF/'$ABC'/'\
This is only the inner two for loops of the code. When the values in the
first bracket (for ABPOW) are positive, the code runs fine. However, when
I have them as i do above, which is what I need, the error communicated to
screen is:
./scripting_test2.bash: line 30: 10**-11: exponent less than 0 (error
token is "1")
How do I make this run? Thanks in advance.
PS: I tried putting a negative sign in front of $ABPOW but the exponents
are still recorded as positive.

No comments:

Post a Comment