Tweak gen_contents_index to work with Solaris's sh