Port report generation script from python to bash