[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Customized interpreter
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 21 Dec 2015 10:01:19 +0200
I'm trying to write a dual-purpose program that executes via
the shebang. It should be callable with parameters, in which
case it does its thing and exits, or without, in which case it
runs the same initialization code and drops down to the REPL.
In order to achieve the second, the shebang line is
#! /usr/local/bin/lua -i
This part works perfectly.
If there are parameters, one can terminate despite the -i by
os.exit.
But -i has the side effect of displaying the Lua welcome message,
which I don't want in the case with parameters. The program should
look like a system utility.
I can think of two solutions:
1. Modify lua.c to have a `-q` option that suppresses the welcome
message even when the REPL is about to be entered,
2. Work without `-i` and use debug.debug to provide the REPL.
This is not very nice since debug.debug does not provide readline
support, history etc.
Am I missing a trick somewhere?