look at status.shell_escape from Lua (you can see the latex
tools/shellesc.sty (which also works with plain) for an example:
\chardef\ShellEscapeStatus
\ifx\pdfshellescape\@undefined
\ifx\shellescape\@undefined
\ifx\directlua\@undefined
\z@
\else
\directlua{%
tex.sprint((status.shell_escape or os.execute()) .. " ")}
\fi
\else
\shellescape
\fi
\else
\pdfshellescape
\fi
On Sat, 7 Oct 2023 at 12:46, Andreas Scherer <[email protected]> wrote:
> Dear all,
>
> According to the LuaTeX Reference, primitive '\pdfshellescape' has been
> removed and "can be implemented using Lua".
>
> What would be a canonical way to implement this code (from 'pwebmac.tex')
>
> \ifpdftex \ifnum\pdfshellescape=1 {\let\\=\BS
> \global\countD=\input{|grep -c -e '\\:\\X' \jobname.tex}} \fi\fi
>
> for use with LuaTeX? Without the '\ifnum\pdfshellescape' part, but with
> 'luatex --shell-escape', the pipe is correctly executed.
>
> How can I detect option '--shell-escape' in my macro code?
>
> TIA,
> Andreas
>