Create the file /usr/local/bin/rlsbcl
with such as the following contents
#!/bin/sh
CMD="${SBCL_HOME:-/usr/bin}/sbcl"
exec rlwrap -q '"' -m -O '^\*\>' "${CMD}" "$@"
Subsequently, ensure that the file /usr/local/bin/rlsbcl
is executable by users
[user@host:~]$ chmod +x /usr/local/bin/rlsbcl
Note that the
-m
option for rlwrap enables multi-line editing within the rlwrap environment. This entails that a keyboard command will be available within the rlwrap environment. After receiving the appropriate keyboard command, rlwrap will then run an editor process, the initial command for which may be specified in either the environment variable${RLWRAP_EDITOR}
or by default,${EDITOR}
. In effect, this allows for an alternate method for text entry -- juxtaposed to the default, direct character entry to the input stream -- to provide character input to the shell process effectively wrapped by rlwrap.
For applications in untrusted environments: Note that this introduces, in effect, a channel vector such that may be appropriated for injecting arbitrary file data to the SBCL shell command. To minimize the possible effects of an exploit of this channel vector, SBCL may be installed as to execute within a limited process enivonment. On FreeBSD hosts, a FreeBSD process jail model may be applied. On Solaris hosts, a Solaris Container model may be applied. Alternately, Docker or Capsicum may be available for creating limited process environments on functional operating system hosts.
Corresponding to the -m
argument for rlwrap, it may be helpful to add the following entries to ~/.inputrc
# see manual pages rlwrap(1), readline(3)
"\M-\C-m": rlwrap-accept-line-and-forget # ESC-ENTER
"\C-xe": rlwrap-call-editor # CTRL-x e
After creating that configuration, the keyboard command CTRL-x e
will activate the respective editor command, in the rlwrap environment.
The multiline editor feature may be helpful when using a computational mathematics system such as Maxima or a computational proof system such as ACL2.