Related questions
bc is ignoring scale option
I can't figure out why bc tool sometimes ignores the scale option.
Here is an example:
> echo 'scale=2; 2.777 - 1.4744' | bc
1.3026
Expected result is:
1.30
Additional information:
> bash --version
GNU bash, version 2.05b.0(1)-release (x86_64-suse-linux)
Copyright (C) 2002 Free …
Rounding Numbers with bc in Bash
I want to compute an average with 3 decimal figures, rounded to nearest, using bc.
For example:
average of 3, 3 and 5 should yield 3.667
and
average of 3, 3 and 4 should yield 3.333
I tried:
echo "scale=3; $sum/$n+0.0005" | bc
but scale doesn't behave as I …
Looping through the content of a file in Bash
How do I iterate through each line of a text file with Bash?
With this script:
echo "Start!"
for p in (peptides.txt)
do
echo "${p}"
done
I get this output on the screen:
Start!
./runPep.sh: line 3: syntax error …