Converting buildformat.bat to shell script. Not finished yet, but nearly