#!/usr/bin/python """normalpath - change shebang path to "normal" linux since I keep my filesystem compatible with freeshell.org's, this utility switches it to that of most linux and bsd systems, like that on prohosting.com and netfirms.com. """ import sys, re for filename in sys.argv[1:]: try: file = open(filename, "r") except: continue shebang = file.readline(); match = re.compile("#!/usr/pkg/bin/([a-z]*)\s+(.*)").match(shebang) if match is not None: if match.groups(1)[0] == 'bash': print '#!/bin/bash %s' % match.groups(1)[1] else: print '#!/usr/bin/%s %s' % match.groups(1) sys.stdout.write(file.read()) else: file.seek(0, 0) sys.stdout.write(file.read())