Change to allow scripts to contain '~' in the filename.