linux - Is it possible to include command line options in the python shebang? -
i have canonical shebang @ top of python scripts.
#!/usr/bin/env python
however, still want export unbuffered output log file when run scripts, end calling:
$ python -u myscript.py &> myscript.out &
can embed -u option in shebang so...
#!/usr/bin/env python -u
and call:
$ ./myscript.py &> myscript.out &
...to still unbuffering? suspect won't work, , want check before trying. there accomplish this?
you can have arguments on shebang line, operating systems have small limit on number of arguments. posix requires 1 argument supported, , common, including linux.
since you're using /usr/bin/env
command, you're using 1 argument python
, can't add argument -u
. if want use python -u
, you'll need hard-code absolute path python
instead of using /usr/bin/env
, e.g.
#!/usr/bin/python -u
see related question: how use multiple arguments shebang (i.e. #!)?
Comments
Post a Comment