buildgcc: Remove all bashisms, making the script run also on BSD