ensure script is portable to non-GNU systems (bug #4509)