[TUHS] shell escapes in utilities

arnold at skeeve.com arnold at skeeve.com
Wed Aug 2 06:40:06 AEST 2023

Dave Horsfall <dave at horsfall.org> wrote:

> Not quite a Shell escape but possibly just as dangerous: EX/VI had/has the 
> ability to embed EX commands within a file to be run when opened e.g. "se 
> ts=4 sw=4" etc; no doubt EMACS has the same "feature".
> It would also recognise the EXINIT environment variable.
> -- Dave

These are called "modelines".  In modern vim they have to be in the
first 4 or last 4 lines of a file (or so) and vim is careful about
what it will run from a modeline.

I *think* other vi versions have an option to enable modelines in
the .exrc file, which is off by default, but I no longer remember
the details.


More information about the TUHS mailing list