Why does Scala use a reversed shebang (!#) instead of just setting interpreter to scala

前端 未结 3 1065
南方客
南方客 2020-12-11 16:34

The scala documentation shows that the way to create a scala script is like this:

#!/bin/sh
exec scala \"$0\" \"$@\"
!#
/* Script here */

I

3条回答
  •  无人及你
    2020-12-11 17:12

    How old is the documentation? Usually, this sort of thing (often referred to as 'the exec hack') was recommended before /bin/env was common, and this was the best way to get the functionality. Note that /usr/bin/env is more common than /bin/env, and ought to be used instead.

提交回复
热议问题