[NTG-context] \ifshellescape

Aditya Mahajan adityam at umich.edu
Tue Dec 26 18:48:12 CET 2006

On Tue, 26 Dec 2006, Mojca Miklavec wrote:

> Hello,
> is there any command to test for write18/shell escape available in ConTeXt?

\ifeof18 checks if write18 is disabled. I think that it is etex only.

The next method is error prone, for a lot of reasons, the directory 
/tmp may not exist (atleast in Windows). A bit safer option may be 
$TEMP. I do not know of \ifmiktex switch, but I am sure TeXLive on 
windows will not set it to true.

> In one of the LaTeX packages I saw:
> \newif\ifShellEscape
> ...
> \ifShellEscape
>    \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time}
>    \ifmiktex
>       \immediate\write18{rem >"\tmpfile"}
>    \else
>       \immediate\write18{touch \tmpfile}
>    \fi
>    \ifmiktex
>       \IfFileExists{\tmpfile.}{\ShellEscapetrue}{\ShellEscapefalse}
>    \else
>       \IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
>    \fi
> \fi


More information about the ntg-context mailing list