Good idea. Let's see how I can do such calculation in shell scripting :) Regarding the error catching, all the error messages returned by the commands are printed in the standard output.