Penguin

Differences between current version and predecessor to the previous major change of HereStrings.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 10 Last edited on Tuesday, December 26, 2006 3:05:05 pm by LawrenceDoliveiro
Older page: version 9 Last edited on Monday, December 11, 2006 2:07:51 am by BenStaz Revert
@@ -20,4 +20,20 @@
 Make sure the variable is surrounded by *double* quotes! 
  
 *string="this:is:a:string"; IFS=: ; read foo bar moo cow <<< "$string" 
 *echo $foo $bar $moo $cow 
+  
+!Quick calculator  
+<pre>  
+ bc <<<"2 + 2"  
+ 4  
+</pre>  
+Note that, while bc(1) supports arbitrary precision, the default number of decimal points it displays is zero:  
+<pre>  
+ bc <<<"3 / 2"  
+ 1  
+</pre>  
+To change this, set the "scale" variable to the number of decimal places you want to see:  
+<pre>  
+ bc <<<"scale = 3; 3 / 2"  
+ 1.500  
+</pre>