Escape error message output, remove short echo semicolons, replace print...

...f with sprintf