Alternative to env that accepts arguments It is commonly known that env does not allow passing of arguments - at least not reliably. There are various workarounds described here, but they felt to hacky and unreadable to me. That's why I developed an alternative, ex.

ex:

#!/usr/bin/env bash

# save the string given in the sheband line
shebang_line="$1"

# remove it from $@
shift

# execute 
# not quoting shebang_line is intentional
eval $(echo $shebang_line "$@")


test.py

#!/usr/local/bin/ex python "-i"
# quoting the arguments is possible
import sys

print('hello', sys.argv)


It works surprisingly well, but I don't like the eval-echo thing. I tried experimenting with arrays, but haven't found a solution. Any tips?
I don't recommend calling your program ex.  That name has a well established meaning in the Unix world as the name of a text-editing tool.