Zachary Ware <zachary.w...@gmail.com> added the comment:
This can be accomplished already by just including newlines in the string: $ cat multiline_python_bash_script.sh #!/bin/bash python3 -c ' from math import * print(e**(1j * pi)) import sys print(sys.argv)' echo "here's some random text" > somefile.txt python3 -c ' with open("somefile.txt") as f: print(len(f.read())) import sys print(sys.argv)' python3 - << EOF import sys print("Here's another way to do it, without restrictions on quotes") print(sys.argv) EOF $ ./multiline_python_bash_script.sh (-1+1.2246467991473532e-16j) ['-c'] 24 ['-c'] Here's another way to do it, without restrictions on quotes ['-'] $ python3 -c " > print('Interactive test:') > print('Multi-line works') > " Interactive test: Multi-line works None of these options is particularly *pretty*, but if it's at the point the ugliness bothers you it should probably be its own file to be executed :). On the other hand, none of these options really works on Windows, as far as I know. ---------- nosy: +zach.ware _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40568> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com