Skip to content

Commit baa63f1

Browse files
committed
Fixed a bug due to escape sequence.
1 parent 56ad072 commit baa63f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ def main():
1010
filename = args[0].split("/")[-1].split(".")[0]
1111

1212
with open(f"{filename}.tmpbash", 'w') as f:
13-
f.write("#!/bin/bash\n\npython3 -c \"\nimport os\n__file__ = f\\\"{os.getcwd()}/"+args[0].split("/")[-1]+"\\\"\n\n")
13+
f.write("#!/bin/bash\n\npython3 -c '\nimport os, sys\n__file__ = sys.argv[0] = f\"{os.getcwd()}/"+args[0].split("/")[-1]+"\"\n\n")
1414
for line in code:
15-
line = line.replace("\\", "\\\\").replace("\"", "\\\"")
15+
line = line.replace("'", "'\"'\"'")
1616
f.write(f"{line}\n")
17-
f.write("\" \\$\\@")
17+
f.write("' $@")
1818

1919
os.system(f"shc -f {filename}.tmpbash")
2020
os.remove(f"{filename}.tmpbash")

0 commit comments

Comments
 (0)