Instead of using echo let's try Perl and the format() built-in.
Use shave (http://git.lespiau.name/cgit/shave) to make compilation more human friendly.