BC Programming Language - Using BC in Shell Scripts

Using Bc in Shell Scripts

bc can be used non-interactively, with input via a pipe. This is useful inside shell scripts. For example:

$ result=$(echo "scale=2; 5 * 7 / 3;" | bc) $ echo $result 11.66

In contrast, note that the bash shell only performs integer arithmetic, e.g.:

$ result=$((5 * 7 /3)) $ echo $result 11

Read more about this topic:  Bc Programming Language

Famous quotes containing the word shell:

    How then can we account for the persistence of the myth that inside the empty nest lives a shattered and depressed shell of a woman—a woman in constant pain because her children no longer live under her roof? Is it possible that a notion so pervasive is, in fact, just a myth?
    Lillian Breslow Rubin (20th century)