[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Practical Shebang (#!) Trick (Better Than /usr/bin/env)
- From: William Ahern <william@...>
- Date: Fri, 23 Jan 2015 15:56:24 -0800
On Fri, Jan 23, 2015 at 02:21:58PM -0800, William Ahern wrote:
> My recently released runlua utility has an option to load and skip over any
> initial shell code in the file. But I just discovered a neat trick which
> obviates the need for such a feature.
> exec lua "$0" "$@"
> print("Running", _VERSION)
> print("Options", ...)
> Probably others have figured this out, too, but it's new to me.
Rena posted nearly the same thing a few years ago:
His example is also portable. It doesn't rely on anything unique to bash.