solution added as well as an extended documentation part of the shellscript.