Stefan Ram wrote:
Annada Behera <[email protected]> wrote or quoted:
Anybody has any idea how that can be done. Thank you.
Lately, the newer versions of "shellesc" (like since 2020?)
shellesc.dtx says the command \ShellEscapeStatus is a TeX <number>
quantity of the kind \chardef-token and was introduced in
version v1.0a of the shellesc package, released 2019/10/13 .
\ShellEscapeStatus is defined by the following lines:
\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
You also find an example for querying which does with \ifcase:
\ifcase\ShellEscapeStatus
\PackageWarning{shellesc}{Shell escape disabled}
\or
\PackageInfo {shellesc}{Unrestricted shell escape enabled}
\else
\PackageInfo {shellesc}{Restricted shell escape enabled}
\fi
are said to define "ShellEscapeStatus." So, you could totally
do something like this:
\usepackage{shellesc}
\ifnum\ShellEscapeStatus=1 \else
\PackageError{mypackage}{use shell escape}{or else}
\fi
If you neither want to load the package nor want to define the
chardef-token you can do s.th. like
\makeatletter
\ifcase
\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
\PackageWarning{shellesc}{Shell escape disabled}
\or
\PackageInfo {shellesc}{Unrestricted shell escape enabled}
\else
\PackageInfo {shellesc}{Restricted shell escape enabled}
\fi
\makeatother
But since I'm rocking an older version, I can't check this out
myself!
For checking out you can
- look at the documentation of most recent releases of packages at CTAN.
- test with a rathher recent TeX Live release via Overleaf -
https://de.overleaf.com/
- try the test page (
https://texlive.net/run) of the
The TeXLive.net Server,
https://texlive.net/ .
Ulrich
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)