Install python script, adjusting the shebang
This commit is contained in:
commit
7de842141d
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("source")
|
||||
ap.add_argument("destination")
|
||||
|
||||
args = ap.parse_args()
|
||||
|
||||
with open(args.source) as inf:
|
||||
with open(args.destination, "w") as outf:
|
||||
first_line = inf.readline()
|
||||
if first_line.startswith("#!"):
|
||||
print("#!", sys.executable, file=outf)
|
||||
else:
|
||||
print("#!", sys.executable, file=outf)
|
||||
outf.write(first_line)
|
||||
for line in inf:
|
||||
outf.write(line)
|
||||
|
||||
shutil.copymode(args.source, args.destination)
|
Loading…
Reference in New Issue