Fix shm/hash to not surround inserted # with spaces if at the beginning of line

Intended for #includes etc.