Fixed to run on sh as well as bash.